From unknown Sun Jun 15 08:38:51 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#40325 <40325@debbugs.gnu.org> To: bug#40325 <40325@debbugs.gnu.org> Subject: Status: make backup files for "-i" option invisible Reply-To: bug#40325 <40325@debbugs.gnu.org> Date: Sun, 15 Jun 2025 15:38:51 +0000 retitle 40325 make backup files for "-i" option invisible reassign 40325 sed submitter 40325 nokangaroo severity 40325 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 30 11:41:03 2020 Received: (at submit) by debbugs.gnu.org; 30 Mar 2020 15:41:03 +0000 Received: from localhost ([127.0.0.1]:34909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIwX8-0007my-NF for submit@debbugs.gnu.org; Mon, 30 Mar 2020 11:41:03 -0400 Received: from lists.gnu.org ([209.51.188.17]:39916) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jItDg-0007ir-Sp for submit@debbugs.gnu.org; Mon, 30 Mar 2020 08:08:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36495) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jItDf-0004rO-R9 for bug-sed@gnu.org; Mon, 30 Mar 2020 08:08:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.9 required=5.0 tests=BAYES_40,DATE_IN_PAST_24_48, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPOOFED_FREEMAIL, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jItDe-0006Vy-Ox for bug-sed@gnu.org; Mon, 30 Mar 2020 08:08:43 -0400 Received: from smtpout.aon.at ([195.3.96.115]:34371) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jItDe-0006U2-ER for bug-sed@gnu.org; Mon, 30 Mar 2020 08:08:42 -0400 Received: (qmail 20739 invoked from network); 30 Mar 2020 12:08:38 -0000 Received: from 100-69-160-118.rfc6598.a1.net (HELO golem.localdomain) ([100.69.160.118]) (envelope-sender ) by smarthub79.res.a1.net (qmail-ldap-1.03) with SMTP for ; 30 Mar 2020 12:08:38 -0000 X-A1Mail-Track-Id: 1585570118:20599:smarthub79:100.69.160.118:1 Date: Sat, 28 Mar 2020 17:00:12 +0100 From: nokangaroo To: bug-sed@gnu.org Subject: make backup files for "-i" option invisible Message-Id: <20200328170012.358bb8a78458a50f43f79267@aon.at> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 195.3.96.115 X-Spam-Score: 3.0 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: The visible backup files create problems with file managers, e. g. they show up in MATE, and I have to reload the folder to make them disappear. The following patch creates invisible files: --- sed/execute.c 2020-01-01 20:38:19.000000000 +0100 +++ sed/execute.c 2020-03-26 12:17:30.209662815 +0100 @@ -614,7 +614,7 @@ } } Content analysis details: (3.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: aon.at] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (aon.913677709[at]aon.at) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (aon.913677709[at]aon.at) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.5 DATE_IN_PAST_24_48 Date: is 24 to 48 hours before Received: date -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [209.51.188.17 listed in list.dnswl.org] 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 30 Mar 2020 11:41:02 -0400 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: 0.0 (/) The visible backup files create problems with file managers, e. g. they show up in MATE, and I have to reload the folder to make them disappear. The following patch creates invisible files: --- sed/execute.c 2020-01-01 20:38:19.000000000 +0100 +++ sed/execute.c 2020-03-26 12:17:30.209662815 +0100 @@ -614,7 +614,7 @@ } } - output_file.fp = ck_mkstemp (&input->out_file_name, tmpdir, "sed", + output_file.fp = ck_mkstemp (&input->out_file_name, tmpdir, ".sed", write_mode); register_cleanup_file (input->out_file_name); output_file.missing_newline = false; This works because ck_mkstemp tests for strlen. BTW why not use /tmp instead of '.'? -- nokangaroo From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 31 01:20:59 2020 Received: (at 40325) by debbugs.gnu.org; 31 Mar 2020 05:20:59 +0000 Received: from localhost ([127.0.0.1]:35399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJ9Kd-0004xm-Di for submit@debbugs.gnu.org; Tue, 31 Mar 2020 01:20:59 -0400 Received: from mail-pj1-f43.google.com ([209.85.216.43]:53950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJ9Kb-0004xW-Qd for 40325@debbugs.gnu.org; Tue, 31 Mar 2020 01:20:58 -0400 Received: by mail-pj1-f43.google.com with SMTP id l36so588362pjb.3 for <40325@debbugs.gnu.org>; Mon, 30 Mar 2020 22:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=TJgOONBnTU9XijT1fcvE8NcWZZm6yTK07L3QCT2GuoI=; b=A8uzi3m+lN+5MTv2REtp0ZEalIVjXobTEP7N00HYpxWWIPrEvcm5TWbZXbtesBXRT7 crMSzaSQ4mj+ShdN5VSAPfzsZCWY7Sr+28G9Qmjdkq+CEV3mYqJILjV1vI5QctY2GV9u 9sBoHPXKv1R9lbVS+R1hmkJB5llZhlyhH0TIX7tw3wLjfTdzxSkA6rN8TD2YOaCRZdnP YMTSsTWZ+dFr+brUB+TVO66eyO+BJgWvHGAWe1IJ/s9d+OFkDNFFh2dFwPZRmq5MxAqY oY5gNwL/QfO53KZmDOYsBAsK4IrKvIfxpEhKORyZw3UtvIulkcxgFOYPTosMSyE2o3ZR elEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=TJgOONBnTU9XijT1fcvE8NcWZZm6yTK07L3QCT2GuoI=; b=f5Hgncpr1+CExw8vmlrTZvgwdxiVHtfsqNNxCe8vXYUQmB20W5Nh3VB3K/FUQdmMwC a+njZdUxSTUsCkJoVpD4ReFOym/CdzhbdvKd32m8BT5gnF4hAo3Qll3G7rmU+UGjQ1Tq NLIJLDWYroeEkGJ2K4VIZ4fdrLZCVHPkye9oszzJLc3nDjWsiSIfGCGhC/6uGlN1nI59 QsOOf6MX5hfZXMgcKlXu5DIcDBGRDEJ8uzuqY/Tl9XZT4xdw+d6IDYxAuV2Y1x4yklmD /lTH0topbCGIrSbYQLGgmHkLbBgNgA8RjH7HivwkOolCVKLaVDdw+0XjutUQT8iKqMqj Q4XQ== X-Gm-Message-State: AGi0PuapWD7ah5mfdN2n/u61+yVe05nPQKOrcH3I3fN33f+U4ZlVp4uq p5DraxI9mYBQt/zfc4VO+70guBI+ X-Google-Smtp-Source: APiQypKSoX62fCDnZtQVjZ689YcZluvvIqwkQzd9yXKYLgk52IGIWCUeEIN4urJac/n5lul6WqOgSQ== X-Received: by 2002:a17:902:d909:: with SMTP id c9mr2545229plz.6.1585632050988; Mon, 30 Mar 2020 22:20:50 -0700 (PDT) Received: from tomato.moose.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id d3sm950887pjz.2.2020.03.30.22.20.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Mar 2020 22:20:49 -0700 (PDT) Subject: Re: bug#40325: make backup files for "-i" option invisible To: nokangaroo , 40325@debbugs.gnu.org References: <20200328170012.358bb8a78458a50f43f79267@aon.at> From: Assaf Gordon Message-ID: Date: Mon, 30 Mar 2020 23:20:48 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200328170012.358bb8a78458a50f43f79267@aon.at> Content-Type: multipart/mixed; boundary="------------68EAAB7C89D180429242493D" Content-Language: en-US X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40325 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 (-) This is a multi-part message in MIME format. --------------68EAAB7C89D180429242493D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello, On 2020-03-28 10:00 a.m., nokangaroo wrote: > The visible backup files create problems with file managers, e. g. they show up > in MATE, and I have to reload the folder to make them disappear. The following > patch creates invisible files: Nice idea, and doesn't seem to cause any regressions. If there are no objects (Jim?), I'll push this soon in your name. The patch is small enough that copyright assignment is not necessary. > BTW why not use /tmp instead of '.'? When using "-i/--in-place", the new content is first written to the temporary file, and then a rename(2) sys-call is used to replace the input file with the new file. When the two files are in the same directory, such rename(2) sys-call is atomic and quick. On many systems the "/tmp" directory is mounted on a different file system (or in memory), and we'd have to use a non-atomic and slower "copy+delete" instead of a rename(2). regards, - assaf --------------68EAAB7C89D180429242493D Content-Type: text/x-patch; charset=UTF-8; name="0001-sed-make-backup-files-for-i-option-invisible.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-sed-make-backup-files-for-i-option-invisible.patch" >From 281b457e05a9fdb7b13dd3eb038455121b8747f7 Mon Sep 17 00:00:00 2001 From: nokangaroo Date: Mon, 30 Mar 2020 23:07:53 -0600 Subject: [PATCH] sed: make backup files for "-i" option invisible The visible backup files create problems with file managers, e. g. they show up in MATE, and I have to reload the folder to make them disappear. The following patch creates invisible files. * sed/execute.c (open_next_file): Use ".sed" as basename for ck_mkstemp to create a hidden file (on unix systems). --- sed/execute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sed/execute.c b/sed/execute.c index f94b125..28573fc 100644 --- a/sed/execute.c +++ b/sed/execute.c @@ -614,7 +614,7 @@ open_next_file (const char *name, struct input *input) } } - output_file.fp = ck_mkstemp (&input->out_file_name, tmpdir, "sed", + output_file.fp = ck_mkstemp (&input->out_file_name, tmpdir, ".sed", write_mode); register_cleanup_file (input->out_file_name); output_file.missing_newline = false; -- 2.20.1 --------------68EAAB7C89D180429242493D-- From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 03 19:00:44 2020 Received: (at 40325) by debbugs.gnu.org; 3 Apr 2020 23:00:44 +0000 Received: from localhost ([127.0.0.1]:43291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKVIq-0007Dx-Kq for submit@debbugs.gnu.org; Fri, 03 Apr 2020 19:00:44 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]:45863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKVIo-0007DU-RG for 40325@debbugs.gnu.org; Fri, 03 Apr 2020 19:00:43 -0400 Received: by mail-wr1-f49.google.com with SMTP id t7so10387083wrw.12 for <40325@debbugs.gnu.org>; Fri, 03 Apr 2020 16:00:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oTvg4IRd6HzevdTAGXfRz7aKsGhR6WHzXbs/UkP7d6Q=; b=OkKNlkJKr0XJxwFHGdgjbjHtinjK0u3O+m7MtceVZX+6GcX0pANqleTH6zSh8FLg06 sZVXrCeLG0/0VrPNlVtl0JVbH6aCQtlR2u/s1d/3GOCeliT2s0S/JUcXlx1RaoaH3f39 XqtEGVEzy1sJ04YitGMXxzzKw3dnblvxos69Iq1m804XSDjwOT1z8kf3pi2wB8yHroF9 9Lifm7mesxLWvzTfAY+wdSIzNwzCFLVsZkfNtFXpR7gPTI70y7Na02isG5anA4QtK8/m 8EXF5iqokU0LpG4aMRmzUAn88Ex1Qmfwa3NTzPyHgYES3jtjzEO1Hi5Nc/ioIE3AQOQG RlEA== X-Gm-Message-State: AGi0PubHOttnOu4VA4Jac8L6Fu7wUO6SnV2EfkmYImTdUBkSHjqq08+N 0aHCONSrlFllAoWEbb9uWzXj+ayWnySRNx+wUxg= X-Google-Smtp-Source: APiQypK7JGSRLhsRqOHCn+3uirZiLNmAaEk7RbpQC88DWfFO0Y2xAWAPlZku59HccWfzBWvTIreu1WxLXo3khqqsmVw= X-Received: by 2002:adf:97d0:: with SMTP id t16mr11478744wrb.343.1585954836992; Fri, 03 Apr 2020 16:00:36 -0700 (PDT) MIME-Version: 1.0 References: <20200328170012.358bb8a78458a50f43f79267@aon.at> In-Reply-To: From: Jim Meyering Date: Fri, 3 Apr 2020 16:00:24 -0700 Message-ID: Subject: Re: bug#40325: make backup files for "-i" option invisible To: Assaf Gordon Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 40325 Cc: nokangaroo , 40325@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: -0.5 (/) On Mon, Mar 30, 2020 at 10:21 PM Assaf Gordon wrote: > Hello, > > On 2020-03-28 10:00 a.m., nokangaroo wrote: > > The visible backup files create problems with file managers, e. g. they show up > > in MATE, and I have to reload the folder to make them disappear. The following > > patch creates invisible files: > > Nice idea, and doesn't seem to cause any regressions. > If there are no objects (Jim?), I'll push this soon in your name. > The patch is small enough that copyright assignment is not necessary. > > > BTW why not use /tmp instead of '.'? > > When using "-i/--in-place", the new content is first written > to the temporary file, and then a rename(2) sys-call is used to replace > the input file with the new file. > > When the two files are in the same directory, > such rename(2) sys-call is atomic and quick. > > On many systems the "/tmp" directory is mounted > on a different file system (or in memory), > and we'd have to use a non-atomic and slower "copy+delete" instead of > a rename(2). Thank you both! Perhaps s/invisible/hidden/ in the commit log. Also, Assaf, would you please add a NEWS entry, since this is a user-visible change? Thanks, Jim