From unknown Mon Aug 18 02:31:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#56603 <56603@debbugs.gnu.org> To: bug#56603 <56603@debbugs.gnu.org> Subject: Status: [PATCH] Ensure that directories exist when copying files from archive Reply-To: bug#56603 <56603@debbugs.gnu.org> Date: Mon, 18 Aug 2025 09:31:13 +0000 retitle 56603 [PATCH] Ensure that directories exist when copying files from= archive reassign 56603 emacs submitter 56603 Visuwesh severity 56603 normal tag 56603 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 16 11:20:52 2022 Received: (at submit) by debbugs.gnu.org; 16 Jul 2022 15:20:52 +0000 Received: from localhost ([127.0.0.1]:45768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCjbA-0002L2-4l for submit@debbugs.gnu.org; Sat, 16 Jul 2022 11:20:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:34884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCjb6-0002Ks-AC for submit@debbugs.gnu.org; Sat, 16 Jul 2022 11:20:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCjb6-0007nc-5r for bug-gnu-emacs@gnu.org; Sat, 16 Jul 2022 11:20:48 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:33345) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oCjb4-00056W-Hq for bug-gnu-emacs@gnu.org; Sat, 16 Jul 2022 11:20:47 -0400 Received: by mail-pf1-x443.google.com with SMTP id v7so7097186pfb.0 for ; Sat, 16 Jul 2022 08:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:user-agent:mime-version; bh=dWTKmyY7vTITpBI+lQvbxLNwuN3eFBlgNlEL7Lashm8=; b=NuP2NrjrTs8a0cUhEV+vPU/snnLOn2zv3saBcC3m28+WAlzh/n0ycP7ntvdAj2bobw PfOtTLPmyeASuaDei2/20ZGHA6zhI8JhqVYGB3gW7J71dIKlaEKIxcpc+RLIxwBOj2KD D8a9hphRn7sqkk3pgTr3k/VIxuIywQmOwnVy99wMkrjiI+xjGa4gbfXM3fopCsZTJibS 7tGDyFH2x9yb+inT3grps2QtauYaAUm9mNmbzcTKpW+XA4opKOGw73tYcMEQZgZOPzyP MeddfDbwiyGmOn22J1WUkiUm2jBaYHM43p7Ma/7tW3vMJAUOBIuH6fqWptgPluTaI9eO +vqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=dWTKmyY7vTITpBI+lQvbxLNwuN3eFBlgNlEL7Lashm8=; b=Kik8vP9yQGiN+Hz7B/EodbJlRKEsOMij9d2SCIglXfHGUzhsNeXtZ3lbvldlEeaK6m 6U4jHgSDC8EuFDzNC/2jCvWwjqBg4Eu+MJA1pEkSDh0sYB/nq1lflFwK6xEavrVKZUjh DCyUK3FtDZytp2y9BOUsBJJQrPlW+qKAS/NfDuXYUTGKdJZ7vHUcGd3un09+FMSS3Cy3 hVzMpt7ERkVOKV0Ek5yrmkYE1UyvjIUgVbRlle0LpLyBKk7HrnMJlzevidd1dNGItDXp HV1FJSnU2edx2q4ix/Mulh74S5H1qJpQCuEl2BqPdCkJ1F3gIYmxT89PDpX7FOD/cHJf +ovQ== X-Gm-Message-State: AJIora9rjgoatTm2cnm9+K+DGYdWeYZ56ahuH7YnMNvvG5PiwMW8KTT9 R/P0aJtOXonYTJWJGrcjcjprIQfRk/o= X-Google-Smtp-Source: AGRyM1sJMv9MnEO8b05jAbP5ruFLJFgre8/aU7+e5pqjUat4PHMRBXqAo1hyUcuW5WQ9qVaUPLanMA== X-Received: by 2002:a63:91c3:0:b0:419:b004:a99b with SMTP id l186-20020a6391c3000000b00419b004a99bmr12879796pge.331.1657984844392; Sat, 16 Jul 2022 08:20:44 -0700 (PDT) Received: from localhost ([49.205.85.181]) by smtp.gmail.com with ESMTPSA id w188-20020a6282c5000000b0052aee60e058sm5947262pfd.102.2022.07.16.08.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 08:20:41 -0700 (PDT) From: Visuwesh To: bug-gnu-emacs@gnu.org Subject: [PATCH] Ensure that directories exist when copying files from archive Date: Sat, 16 Jul 2022 20:50:38 +0530 Message-ID: <87k08d13uh.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=visuweshm@gmail.com; helo=mail-pf1-x443.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Tags: patch If a zip file is of the following contents, a/some-text.txt a/b/some-other.txt and you mark all files and extract them to the directory /tmp/test/, the current copy command bugs out since `write-to-region' complains about /tmp/test/a/ and /tmp/test/a/b/ not existing. If you tried to extract a single file a/some-text.txt after answer /tmp/ to the prompt, the C command fails due to the above reason. This patch creates the relevant directories if they don't exist. But perhaps the patch should be more robust? I.e., if /tmp/test/a was a file, then it should error? In GNU Emacs 29.0.50 (build 21, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2022-07-16 built on astatine Repository revision: 9a5b52dace4cb0fe6b99205911d9b2f2487a4a83 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid Configured using: 'configure --with-sound=alsa --with-x-toolkit=lucid --with-json --without-xaw3d --without-gconf --without-libsystemd --without-cairo' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Ensure-that-directories-exist-when-copying-files-fro.patch >From 0166179e60644475abb878ecec86c8847871eab6 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Sat, 16 Jul 2022 20:44:50 +0530 Subject: [PATCH] Ensure that directories exist when copying files from archive * lisp/arc-mode.el (archive-copy-file): If the directory the file is being extracted to does not exist, then create it. --- lisp/arc-mode.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index c52f2a4432..e5aadccc87 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -1073,13 +1073,16 @@ archive-copy-file (user-error "Can't copy a list of files to a single file")) (save-excursion (dolist (file files) - (let ((write-to (if (file-directory-p new-name) - (expand-file-name file new-name) - new-name))) + (let* ((write-to (if (file-directory-p new-name) + (expand-file-name file new-name) + new-name)) + (write-to-dir (file-name-directory write-to))) (when (and (file-exists-p write-to) (not (yes-or-no-p (format "%s already exists; overwrite? " write-to)))) (user-error "Not overwriting %s" write-to)) + (unless (file-directory-p write-to-dir) + (make-directory write-to-dir t)) (archive-goto-file file) (let* ((descr (archive-get-descr)) (archive (buffer-file-name)) -- 2.35.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 17 05:23:27 2022 Received: (at 56603) by debbugs.gnu.org; 17 Jul 2022 09:23:27 +0000 Received: from localhost ([127.0.0.1]:46665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oD0Up-0003El-5I for submit@debbugs.gnu.org; Sun, 17 Jul 2022 05:23:27 -0400 Received: from quimby.gnus.org ([95.216.78.240]:37760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oD0Un-0003EX-Oa for 56603@debbugs.gnu.org; Sun, 17 Jul 2022 05:23:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=1pS4KLX+dztoTgmPTuLeRcjggJ3iUgbiM4rk6gZOJ7Q=; b=rfuroRevu6SxujAWaYYCGhSU4X hLAkHqmvZcnc+qbSt/PmvkzZYkoCBJ8W52Y1/FOEQbM/51EDxL1c+nyz419lhAVtfrYr/zBa/iYlO qbu9nrKr7F6jSKt2Hos7hbAL/ScUKfgRPkhmj/mnYD40w4DICHfHfdhAl4YW1Tdf8uYw=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oD0Uf-0005KK-DD; Sun, 17 Jul 2022 11:23:19 +0200 From: Lars Ingebrigtsen To: Visuwesh Subject: Re: bug#56603: [PATCH] Ensure that directories exist when copying files from archive In-Reply-To: <87k08d13uh.fsf@gmail.com> (Visuwesh's message of "Sat, 16 Jul 2022 20:50:38 +0530") References: <87k08d13uh.fsf@gmail.com> X-Now-Playing: Fairport Convention's _Come All Ye (4)_: "Maverick Child" Date: Sun, 17 Jul 2022 11:23:15 +0200 Message-ID: <87sfn0m6t8.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Visuwesh writes: > This patch creates the relevant directories if they don't exist. But > perhaps the patch should be more robust? I.e., if /tmp/test/a was a > file, then it should error? Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 56603 Cc: 56603@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Visuwesh writes: > This patch creates the relevant directories if they don't exist. But > perhaps the patch should be more robust? I.e., if /tmp/test/a was a > file, then it should error? We'll get an error from that make-directory call, and I think that's sufficient, so I've pushed your patch to Emacs 29. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 17 05:23:33 2022 Received: (at control) by debbugs.gnu.org; 17 Jul 2022 09:23:33 +0000 Received: from localhost ([127.0.0.1]:46668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oD0Uv-0003F3-Ei for submit@debbugs.gnu.org; Sun, 17 Jul 2022 05:23:33 -0400 Received: from quimby.gnus.org ([95.216.78.240]:37774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oD0Ut-0003Ek-Qp for control@debbugs.gnu.org; Sun, 17 Jul 2022 05:23:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rLHGK3rE22Il6lLeaoh8Drl1pGgNHf1o8osifgpX1C8=; b=dNWgfzQbHEnZx19XsodNuOvcsN HGYrF9K0Jo37LKnELoBZ+6OdSFuGrNDq/nfGeqAwHCwrGY5v4cfWGnpXARGjg+UxdydDRzvGq+mu4 /L4k4Yv7o8jbtbPkNjoi6KEoDkjuz7PYGGQFL4+pjnmBoJucKrUes6+22N1WfMnparM0=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oD0Ul-0005KU-S3 for control@debbugs.gnu.org; Sun, 17 Jul 2022 11:23:25 +0200 Date: Sun, 17 Jul 2022 11:23:21 +0200 Message-Id: <87r12km6t2.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #56603 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 56603 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 56603 29.1 quit From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 17 05:58:23 2022 Received: (at 56603) by debbugs.gnu.org; 17 Jul 2022 09:58:23 +0000 Received: from localhost ([127.0.0.1]:46732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oD12d-0006Hp-8D for submit@debbugs.gnu.org; Sun, 17 Jul 2022 05:58:23 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:44652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oD12Y-0006Ha-3X for 56603@debbugs.gnu.org; Sun, 17 Jul 2022 05:58:22 -0400 Received: by mail-pj1-f67.google.com with SMTP id o3-20020a17090a744300b001ef8f7f3dddso10022391pjk.3 for <56603@debbugs.gnu.org>; Sun, 17 Jul 2022 02:58:18 -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 :user-agent:mime-version:content-transfer-encoding; bh=EIRm4ccfjMZ9/5+CBGimV4W8cevyZXzsJXGNBU7Q3bs=; b=GzlW/waUrlZEFYpeDnWi0Yr28p8DTMmV95jHv0Jlvtih3fyj4qFFWIoCct0R7WveBD O+A+9ABmYMMnB9VBUQFeVOYjFE9JvPu2ueF9uLiQzRCht9BhXtJyGucTbIAtV2CJrp0B yptKYOpvjZ761Ce9UFKCRYr4hLwxiVJF0hURAuLwB5FAJ1f+XPQCnM5n/KyWItcqi8rd VVPBgFlCWHMTnHl3DuxaC7+GpAXxo4ljkmF06UxWamROpXARHRkcrRPkn+MusT0BuhL/ 1Uv1Jn5AvzzpQKkY4Qys3p5mdWMLLxqGhY+/Tastyi+tMcb213HPWqgNHahMh97gnG0c HkYQ== 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:user-agent:mime-version:content-transfer-encoding; bh=EIRm4ccfjMZ9/5+CBGimV4W8cevyZXzsJXGNBU7Q3bs=; b=z5C8cdJFpww/+lF52oQIGEldiiPzSgAxhjhgZIHC4o7ZdrLJ5f/HK72vWJwYq1thNZ RUlKjtR5fEoNagwaPGctTOZwyIsxRZcc/G8MjtzbbGBw6SaNm5xoVrgz+zcptdxwH9Fn ZcUz3Lh3aKnEJtGAxn2v7VIVBK2yfl6/OmGt8ld+I3JNWHIrIJGJTHGrdr43E40yMJUI 1SlG3LWsZRG5sjIFw6K35r467xnvdUMwj9oLzXKglszkDOGsqkNXl8gFEXzFS6zvIhfk HYemkgpk8yNkHDPO4Zupb83WGdYNSYv90DUHSI5Cab6G7JLkLIR3HQXV9g6PuFsZKFS7 utyg== X-Gm-Message-State: AJIora+B61XbYg7Nmj0SAyPjrdMRdl3a+CelWP3tKgwQelmbICqubaz6 P0KC7fv4Zq10ezc2OF+rviE= X-Google-Smtp-Source: AGRyM1srOFz/NCk+91XohsChbGc4DWVV4cU+XdxMBr4Hh0+D/t+YbxaDcnFR/vVw7yb6VO2U24o/NQ== X-Received: by 2002:a17:902:f609:b0:168:dcbe:7c4d with SMTP id n9-20020a170902f60900b00168dcbe7c4dmr22333628plg.169.1658051892130; Sun, 17 Jul 2022 02:58:12 -0700 (PDT) Received: from localhost ([49.204.119.55]) by smtp.gmail.com with ESMTPSA id f23-20020a63dc57000000b0041296bca2a8sm6064175pgj.12.2022.07.17.02.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 02:58:10 -0700 (PDT) From: Visuwesh To: Lars Ingebrigtsen Subject: Re: bug#56603: [PATCH] Ensure that directories exist when copying files from archive In-Reply-To: <87sfn0m6t8.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 17 Jul 2022 11:23:15 +0200") References: <87k08d13uh.fsf@gmail.com> <87sfn0m6t8.fsf@gnus.org> Date: Sun, 17 Jul 2022 15:28:02 +0530 Message-ID: <87fsj0kqmt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 56603 Cc: 56603@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=9C=E0=AF=82= =E0=AE=B2=E0=AF=88 17, 2022] Lars Ingebrigtsen wrote: > Visuwesh writes: > >> This patch creates the relevant directories if they don't exist. But >> perhaps the patch should be more robust? I.e., if /tmp/test/a was a >> file, then it should error? > > We'll get an error from that make-directory call, and I think that's > sufficient, so I've pushed your patch to Emacs 29. Thanks From unknown Mon Aug 18 02:31:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 14 Aug 2022 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator