From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YG8XCgj26mIieQEAbAwnHQ (envelope-from ) for ; Thu, 04 Aug 2022 00:26:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id wIkWCQj26mLPfwAAG6o9tA (envelope-from ) for ; Thu, 04 Aug 2022 00:26:16 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BDCAFB725 for ; Thu, 4 Aug 2022 00:26:15 +0200 (CEST) Received: from localhost ([::1]:35946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJMog-0004eZ-VB for larch@yhetil.org; Wed, 03 Aug 2022 18:26:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJMnh-0004bB-G3 for emacs-orgmode@gnu.org; Wed, 03 Aug 2022 18:25:13 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:35483) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJMnS-0001tK-6P for emacs-orgmode@gnu.org; Wed, 03 Aug 2022 18:25:13 -0400 Received: by mail-pg1-x52f.google.com with SMTP id r186so16333463pgr.2 for ; Wed, 03 Aug 2022 15:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=tK1noAE+0I1fFYsmASxrSg8AQU3zKqeUS/W/YbREYLE=; b=TA/1iTD5Kvbr54oqrEGSOXaA1ib6Jz/pJyiAcpG2aWPQEUBm73rjDjew6c7TJ8Ij0e EAgEgosEeE/Hy1YbqYgAOVruSzHb8VGaWsvdBlbxrydMV4KO+RJhm9x7MRaiYwHwvqsH XmcuaC8x2wKsAw5OA9Tj5GEJGiEY0GB9sgmNKHKLpdcIw2U7PjpOx/rl7xxAWtXiCnoU 0k2oxX0nUOcHl0YF/HiB9JZvQObRdvVnk7slHU+nXZE/2nBdgECAJdnDyHOkTKr/U0pZ gfKMzTtOayuVzRDme4MhN/CmmU2tIPPH8GWO18UBR4XoM5IOs0z7I04HzMdr5/1gG0bx I+3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=tK1noAE+0I1fFYsmASxrSg8AQU3zKqeUS/W/YbREYLE=; b=1cZAujzkV/fbPKEuGfGoLLtkQ5QSmqsbuJt28n8oFGweWRTguy3zK9lgIX53Pazwbj HEbxOh+2n+S87If//szQ3MeMyW2PZ/aEojJZs+0FViw2sNdtnXwLevk+rjQfCEGJ6W8n ayXfDDB4Z7QsWWg95VcQqk5DY0Ip9lpHe+XrNq4+SdHKl0Ac4mVYVOBuUVZrMdfx1ms4 GVciOt6PltmizAZ6k3f0ckmhELJgAwJ1Z6hFpbnOq+JiahK24zQcvxAZKaB49KFCJt0W rM42ke6RQjwaxm/islgOVQDBTthkwauYWsQkfGDEk+E34FO6bBErKrqLgHzLj3DBaYuN lJmQ== X-Gm-Message-State: AJIora9BhjYS5Q73dO6s9JjnueaGKdBSyaIbS8o1FfyEZAsfGhBnDffI YblW+2YKnNUiQDx1kdW/exA= X-Google-Smtp-Source: AGRyM1u7UbkHiBBtWInUnrBxFlK8KztQaq+Npk0F6woEMfDKX6ym0JSpsh56tz0/KgW8It6piPpUZw== X-Received: by 2002:aa7:8889:0:b0:52a:f05b:31f5 with SMTP id z9-20020aa78889000000b0052af05b31f5mr27836928pfe.69.1659565496563; Wed, 03 Aug 2022 15:24:56 -0700 (PDT) Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id i8-20020aa796e8000000b0052de390357esm4263849pfq.130.2022.08.03.15.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Aug 2022 15:24:39 -0700 (PDT) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Re: [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)] In-Reply-To: References: <87k084v1wa.fsf@localhost> Date: Thu, 04 Aug 2022 06:25:37 +0800 Message-ID: <871qtxhsm6.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=yantar92@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659565575; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=tK1noAE+0I1fFYsmASxrSg8AQU3zKqeUS/W/YbREYLE=; b=HxjWhFtjPNXlbCTeGFIF0MzpR9PFyonb1vsvXq81ou0b/rdPbDQHN6HuBA37LWtB6qYq4P E+tJWwmEVtaYFDkINqK9lSX7nV9IxI5bR27CmsyYYGiTxITYjw6uCnbzCPU6OP+kWeXKl7 4PRxhauv6dstScxXLtxBnLWTk1OQhMkp+GKU/oRgz884DXRd5F+rIjZIpfXDHvPJGuKgG6 FwLAeT5BJANvlphsx2GfFID276KsE7rxJ/wesD8D/kRBKhoIiK3Z31xCj27A4YCTYFCIaB m2GUr2S+lhxcvW+lQnhgMV1AY4YMHyiEwtCSn++unY20ituL/AwA9gOJguKv+A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659565575; a=rsa-sha256; cv=none; b=CAow7kPiWZUiWIyPY1l9NH3R0MwJsVayOqUqds5E23VmliPUHnFC5tck/U+6uiCyTogcS0 0sURwCC9TOwPYOmXopZhpTkRpgBO7xpUL0RE7xRr1hhTKHMo6LqW5r4TgEaXMgEzJ7j8eY savGZR0cVfW2+X2EZ8CWcmMiB1v4pwnkyssBCG5MzBSRulPiFMIEkiQFkSUke85OSQLP0N fvRffhhGN0DTOMwCMI0Vg8IMxvtcoDq5ZTZn/am+2YV7ZT8acr/DQ8szt/Yd5aQQYlfYpw lTbU/Wm5QNr/BRCfS18VTONAEcS8wuLSe3OgY2vZo77ocY9ne1cs0U7OboFeSg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="TA/1iTD5"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -6.91 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="TA/1iTD5"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: BDCAFB725 X-Spam-Score: -6.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: qTS2S02ZKDjC Max Nikulin writes: > On 23/07/2022 12:22, Ihor Radchenko wrote: >> Tentative patch is attached. > >> + (if (< (length id) 3) >> + (org-attach-id-uuid-folder-format (md5 id)) > > Ihor, I am afraid of collisions due to short input to md5. Long hash > value gives false impression of high entropy but actually there are not > so many variants for 1 or 2 characters strings. Either there is no point > in making long name from short id or random string of appropriate length > should be used instead. Random is not an option. If we use random string, how will we get the right attachment path on a second call? This function must return the same value given the same input. Having said that, I do agree (taking into account the other comment) that md5 may not be a very good idea. Maybe simply something like "__/id". Ideally, we should be able to recover the original id from the path to attachment. Best, Ihor