From unknown Mon Aug 18 08:56:18 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#11809 <11809@debbugs.gnu.org> To: bug#11809 <11809@debbugs.gnu.org> Subject: Status: document "So how do we just simply make a backup file?" Reply-To: bug#11809 <11809@debbugs.gnu.org> Date: Mon, 18 Aug 2025 15:56:18 +0000 retitle 11809 document "So how do we just simply make a backup file?" reassign 11809 coreutils submitter 11809 jidanni@jidanni.org severity 11809 normal tag 11809 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 28 11:35:54 2012 Received: (at submit) by debbugs.gnu.org; 28 Jun 2012 15:35:54 +0000 Received: from localhost ([127.0.0.1]:35318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkGl7-0006lv-Pe for submit@debbugs.gnu.org; Thu, 28 Jun 2012 11:35:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40674) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkGl5-0006lm-L9 for submit@debbugs.gnu.org; Thu, 28 Jun 2012 11:35:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SkGgr-0003l3-BS for submit@debbugs.gnu.org; Thu, 28 Jun 2012 11:31:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:34977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkGgq-0003kn-TL for submit@debbugs.gnu.org; Thu, 28 Jun 2012 11:31:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkGgh-0004jN-6t for bug-coreutils@gnu.org; Thu, 28 Jun 2012 11:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SkGgX-0003fH-8B for bug-coreutils@gnu.org; Thu, 28 Jun 2012 11:31:18 -0400 Received: from caiajhbdcaib.dreamhost.com ([208.97.132.81]:60722 helo=homiemail-a62.g.dreamhost.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkGgW-0003c1-FJ for bug-coreutils@gnu.org; Thu, 28 Jun 2012 11:31:09 -0400 Received: from homiemail-a62.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a62.g.dreamhost.com (Postfix) with ESMTP id 11F08634080 for ; Thu, 28 Jun 2012 08:31:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:subject :date:message-id:mime-version:content-type; q=dns; s=jidanni.org ; b=i7hvYQ8P4vZSGs07PxOD++NvKw2w7anxVx+ETRnj8VenYxctiPD000eJacsn G+i2n0UJKhU+WmiUxlZpIRuuqUqT3Tl/TGlA7VL8iAzm1vDFTHsiGkSjPr0QmpX3 GUBpu7L1g1EL4YFD7ynzkZAYW/AMa7aPv6NbW5RXtp/cXdo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to :subject:date:message-id:mime-version:content-type; s= jidanni.org; bh=hf5zGTnfDskI7FIW07cTzgZQtaE=; b=Tz90xGOK78mj37HN k9Ixg7zfB707TX1y7lBBNk6keC+iMmxOJzR+bM1K2VbwSYBaaIUkefyU+S2fMPDP SgkEOphF2MuLskQwFH2O53/fXZmnuLnsLFhYHd0pOInd+kuBuQ9xDOiFh1G6N6lH sHjfsE4FrdrWYIRhnOWyzSrOkOM= Received: from jidanni.org (218-174-215-66.dynamic.hinet.net [218.174.215.66]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jidanni@jidanni.org) by homiemail-a62.g.dreamhost.com (Postfix) with ESMTPSA id C354C634064 for ; Thu, 28 Jun 2012 08:31:02 -0700 (PDT) From: jidanni@jidanni.org To: bug-coreutils@gnu.org Subject: document "So how do we just simply make a backup file?" Date: Thu, 28 Jun 2012 23:30:59 +0800 Message-ID: <87hatv4fnw.fsf@jidanni.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) (info "(coreutils) Backup options") should add some examples, for "So how do we make a backup file of m?" $ ls m $ cp -b m m #no go $ cp m n $ mv -b n m From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 28 12:05:53 2012 Received: (at 11809) by debbugs.gnu.org; 28 Jun 2012 16:05:53 +0000 Received: from localhost ([127.0.0.1]:35379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkHE8-0007SG-91 for submit@debbugs.gnu.org; Thu, 28 Jun 2012 12:05:53 -0400 Received: from mx.meyering.net ([88.168.87.75]:50624) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkHE5-0007S2-K7 for 11809@debbugs.gnu.org; Thu, 28 Jun 2012 12:05:50 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id C32F56009F; Thu, 28 Jun 2012 18:01:31 +0200 (CEST) From: Jim Meyering To: jidanni@jidanni.org Subject: Re: bug#11809: document "So how do we just simply make a backup file?" In-Reply-To: <87hatv4fnw.fsf@jidanni.org> (jidanni@jidanni.org's message of "Thu, 28 Jun 2012 23:30:59 +0800") References: <87hatv4fnw.fsf@jidanni.org> Date: Thu, 28 Jun 2012 18:01:31 +0200 Message-ID: <87ehozs9wk.fsf@rho.meyering.net> Lines: 53 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11809 Cc: 11809@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) jidanni@jidanni.org wrote: > (info "(coreutils) Backup options") should add some examples, for > "So how do we make a backup file of m?" > $ ls > m > $ cp -b m m #no go Thanks for the suggestion. I use this zsh/bash shell function: backup () { local i for i in "$@"; do command cp -bf "$i" "$i" done } but as I inserted the above, I realize it's buggy. It doesn't propagate failure like you'd expect, so here's a better one: backup() { local i fail=0 for i in "$@"; do command cp -bf -- "$i" "$i" || fail=1 done return $fail } That's already almost what info coreutils says: Make a backup of each file that would otherwise be overwritten or removed. As a special case, @command{cp} makes a backup of @var{source} when the force and backup options are given and @var{source} and @var{dest} are the same name for an existing, regular file. One useful application of this combination of options is this tiny Bourne shell script: @example #!/bin/sh # Usage: backup FILE... # Create a @sc{gnu}-style backup of each listed FILE. for i; do cp --backup --force -- "$i" "$i" done @end example I'll adjust that to reflect the above improvement: Do you think that's enough? > $ cp m n > $ mv -b n m From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 28 12:20:28 2012 Received: (at 11809) by debbugs.gnu.org; 28 Jun 2012 16:20:28 +0000 Received: from localhost ([127.0.0.1]:35411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkHSG-0007oO-40 for submit@debbugs.gnu.org; Thu, 28 Jun 2012 12:20:28 -0400 Received: from caiajhbdccac.dreamhost.com ([208.97.132.202]:47182 helo=homiemail-a3.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkHSC-0007oF-9U for 11809@debbugs.gnu.org; Thu, 28 Jun 2012 12:20:26 -0400 Received: from homiemail-a3.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a3.g.dreamhost.com (Postfix) with ESMTP id 90A3C284078; Thu, 28 Jun 2012 09:16:10 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:cc:subject :references:date:message-id:mime-version:content-type; q=dns; s= jidanni.org; b=Iflkq89ONCcxBLc61fEvORbSSRAt9Uh5MC9P4Javqla06Debl Tp51F+68k3gx8V88IwvWh+GxFfZH0KLiCfYB5Z6ULcLzdKLN9CmlfelBHMClyKJM qBmWo+nG7l9BzVnQmy6Pcmy5L5B8Z49g7xN2F/8ZAKF9djqO4jvSl6Sz0U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to:cc :subject:references:date:message-id:mime-version:content-type; s=jidanni.org; bh=WZIS5WXegoED2TBp4fD6Q5DL3CU=; b=JnSXkfQkR7u3q C55RDFF9zvuVSAOyps7QtNgsnIKA5JXBmWXGqgK4Yq/825bc9BG5fLHkudPp2XJz BPvTcikwLbXLXMuv5Bxsco34dUbApE0x36YsJ6P8Hc9xnXCkCWWIRCUKYyvgG2M6 w5zOH5IdwxOUpUay1S3BSxIb0EmKL0= Received: from jidanni.org (218-174-215-66.dynamic.hinet.net [218.174.215.66]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jidanni@jidanni.org) by homiemail-a3.g.dreamhost.com (Postfix) with ESMTPSA id 3DEAD284076; Thu, 28 Jun 2012 09:16:10 -0700 (PDT) From: jidanni@jidanni.org To: jim@meyering.net Subject: Re: bug#11809: document "So how do we just simply make a backup file?" References: <87ehozs9wk.fsf@rho.meyering.net> Date: Fri, 29 Jun 2012 00:16:07 +0800 Message-ID: <87d34j4dko.fsf@jidanni.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11809 Cc: 11809@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) OK but (info "(coreutils) Backup options") should also link back to the exact cp -b spot, else most folks will miss it. P.S., There _is_ an easier way of making backups of several files, But there is a bug, one has to do it one at a time despite -b. Bug bug bug. $ \cp -fb h k l . cp: `h' and `./h' are the same file cp: `k' and `./k' are the same file cp: `l' and `./l' are the same file $ \cp -fb h h $ From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 29 01:56:21 2012 Received: (at 11809) by debbugs.gnu.org; 29 Jun 2012 05:56:21 +0000 Received: from localhost ([127.0.0.1]:36149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkUBo-00018R-Cg for submit@debbugs.gnu.org; Fri, 29 Jun 2012 01:56:20 -0400 Received: from mx.meyering.net ([88.168.87.75]:52688) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkUBl-000184-Bn for 11809@debbugs.gnu.org; Fri, 29 Jun 2012 01:56:18 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 3306A6011B; Fri, 29 Jun 2012 07:52:00 +0200 (CEST) From: Jim Meyering To: jidanni@jidanni.org Subject: Re: bug#11809: document "So how do we just simply make a backup file?" In-Reply-To: <87d34j4dko.fsf@jidanni.org> (jidanni@jidanni.org's message of "Fri, 29 Jun 2012 00:16:07 +0800") References: <87ehozs9wk.fsf@rho.meyering.net> <87d34j4dko.fsf@jidanni.org> Date: Fri, 29 Jun 2012 07:52:00 +0200 Message-ID: <87vciar7gf.fsf@rho.meyering.net> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11809 Cc: 11809@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) jidanni@jidanni.org wrote: > OK but (info "(coreutils) Backup options") should also link back to the exact > cp -b spot, else most folks will miss it. > > P.S., There _is_ an easier way of making backups of several files, > But there is a bug, one has to do it one at a time despite -b. Bug bug bug. > > $ \cp -fb h k l . > cp: `h' and `./h' are the same file > cp: `k' and `./k' are the same file > cp: `l' and `./l' are the same file > $ \cp -fb h h > $ No, that was deliberate. I deliberately restricted the "make backup only" functionality to the very limited case that is documented. Widening the semantics, as you suggest above, seems like it would make this "feature" more likely to be discovered accidentally -- with data loss, when both originals and backups are removed. If people think the make-backup-only feature is useful enough for multiple files, then we can consider adding an --only-backup option, (better name welcome, but it cannot start with "--backup") rather than co-opting the --force --backup combination and requiring a script to process more than one at a time. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 29 04:16:13 2012 Received: (at 11809) by debbugs.gnu.org; 29 Jun 2012 08:16:13 +0000 Received: from localhost ([127.0.0.1]:36283 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkWNB-000590-Bz for submit@debbugs.gnu.org; Fri, 29 Jun 2012 04:16:13 -0400 Received: from mailbigip.dreamhost.com ([208.97.132.5]:55700 helo=homiemail-a38.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkWN8-00058t-QJ for 11809@debbugs.gnu.org; Fri, 29 Jun 2012 04:16:12 -0400 Received: from homiemail-a38.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a38.g.dreamhost.com (Postfix) with ESMTP id 42ADD10AFAB; Fri, 29 Jun 2012 01:11:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:cc:subject :references:date:message-id:mime-version:content-type; q=dns; s= jidanni.org; b=fym/+Mu2vkkYUMkZ9y3TVZaYxAYLzMVaimY6E/vCgTLP6HO/8 4zbroedz/2VBZu1nzInUBKsgWzPQxnc7FuwNqyTCFrAY24l0fvMIs2ZMDz6C8Di8 BTNjwRIDmge5QUUUeU7TOx42U+30OiRHzMsBv5L+7N3nUaW+4aIjd4yKfk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to:cc :subject:references:date:message-id:mime-version:content-type; s=jidanni.org; bh=Lfsz7oRE15juf+OAxV/QdpJbuYM=; b=nOmq0jRogTqUf T4C4K0u9jnn97u8bzUoIOQv6D4SNAx7yMYzTfYleUmPXip0eg5HoSOchqBU3Ruyo VqW0G4ntwDnRJHUQBx0k/YovLJxFo4uWzpSWWvE3MsfXINBw+7xXd0hCE8NPErSi KWF4yY151mC0YX8VXaz/BYg0IGq9y0= Received: from jidanni.org (218-174-209-95.dynamic.hinet.net [218.174.209.95]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jidanni@jidanni.org) by homiemail-a38.g.dreamhost.com (Postfix) with ESMTPSA id DC70110AFA5; Fri, 29 Jun 2012 01:11:52 -0700 (PDT) From: jidanni@jidanni.org To: jim@meyering.net Subject: Re: bug#11809: document "So how do we just simply make a backup file?" References: <87vciar7gf.fsf@rho.meyering.net> Date: Fri, 29 Jun 2012 16:11:45 +0800 Message-ID: <87fw9ezge6.fsf@jidanni.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11809 Cc: 11809@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) JM> I deliberately restricted the "make backup only" functionality to the JM> very limited case that is documented. Well you had better explicitly document that it does not work with all forms in the cp SYNOPSIS, else people will think it is broken... From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 29 04:52:55 2012 Received: (at 11809) by debbugs.gnu.org; 29 Jun 2012 08:52:55 +0000 Received: from localhost ([127.0.0.1]:36333 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkWwh-0005z5-Da for submit@debbugs.gnu.org; Fri, 29 Jun 2012 04:52:55 -0400 Received: from mx.meyering.net ([88.168.87.75]:53148) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkWwd-0005yw-No for 11809@debbugs.gnu.org; Fri, 29 Jun 2012 04:52:53 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id E39EA601AC; Fri, 29 Jun 2012 10:48:30 +0200 (CEST) From: Jim Meyering To: jidanni@jidanni.org Subject: Re: bug#11809: document "So how do we just simply make a backup file?" In-Reply-To: <87ehozs9wk.fsf@rho.meyering.net> (Jim Meyering's message of "Thu, 28 Jun 2012 18:01:31 +0200") References: <87hatv4fnw.fsf@jidanni.org> <87ehozs9wk.fsf@rho.meyering.net> Date: Fri, 29 Jun 2012 10:48:30 +0200 Message-ID: <87vciapkpt.fsf@rho.meyering.net> Lines: 86 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11809 Cc: 11809@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Jim Meyering wrote: > jidanni@jidanni.org wrote: >> (info "(coreutils) Backup options") should add some examples, for >> "So how do we make a backup file of m?" >> $ ls >> m >> $ cp -b m m #no go > > Thanks for the suggestion. > I use this zsh/bash shell function: > > backup () > { > local i > for i in "$@"; do > command cp -bf "$i" "$i" > done > } > > but as I inserted the above, I realize it's buggy. > It doesn't propagate failure like you'd expect, > so here's a better one: > > backup() > { > local i fail=0 > for i in "$@"; do > command cp -bf -- "$i" "$i" || fail=1 > done > return $fail > } > > That's already almost what info coreutils says: > > Make a backup of each file that would otherwise be overwritten or removed. > As a special case, @command{cp} makes a backup of @var{source} when the force > and backup options are given and @var{source} and @var{dest} are the same > name for an existing, regular file. One useful application of this > combination of options is this tiny Bourne shell script: > > @example > #!/bin/sh > # Usage: backup FILE... > # Create a @sc{gnu}-style backup of each listed FILE. > for i; do > cp --backup --force -- "$i" "$i" > done > @end example > > I'll adjust that to reflect the above improvement: > Do you think that's enough? Here's the doc patch I suggested, but I'll hold off for now. I'd like to hear if anyone thinks it's worth adding a new option, which would obviate such a script. >From 3a1bc89c3e3ca277be49d4fceb60abb57e3fc9d2 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 29 Jun 2012 10:45:31 +0200 Subject: [PATCH] doc: improve sample backup script * doc/coreutils.texi (cp invocation): Make the backup script exit with an accurate reflection of any failure. --- doc/coreutils.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 08ef2d8..5207c44 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -7675,9 +7675,11 @@ cp invocation #!/bin/sh # Usage: backup FILE... # Create a @sc{gnu}-style backup of each listed FILE. +fail=0 for i; do - cp --backup --force -- "$i" "$i" + cp --backup --force -- "$i" "$i" || fail=1 done +exit $fail @end example @item --copy-contents -- 1.7.11.1.59.gbc9e7dd From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 29 05:35:01 2012 Received: (at 11809) by debbugs.gnu.org; 29 Jun 2012 09:35:01 +0000 Received: from localhost ([127.0.0.1]:36379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkXbQ-0006v7-N8 for submit@debbugs.gnu.org; Fri, 29 Jun 2012 05:35:01 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:62704) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkXbO-0006v0-MD for 11809@debbugs.gnu.org; Fri, 29 Jun 2012 05:34:59 -0400 Received: from [192.168.2.108] (p4FF744EA.dip.t-dialin.net [79.247.68.234]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0Mb5Ch-1SQxPh3bv1-00KQg1; Fri, 29 Jun 2012 11:30:39 +0200 Message-ID: <4FED75BE.5050004@bernhard-voelker.de> Date: Fri, 29 Jun 2012 11:30:38 +0200 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120601 Thunderbird/13.0 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#11809: document "So how do we just simply make a backup file?" References: <87hatv4fnw.fsf@jidanni.org> <87ehozs9wk.fsf@rho.meyering.net> <87vciapkpt.fsf@rho.meyering.net> In-Reply-To: <87vciapkpt.fsf@rho.meyering.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:0X6iADNYqyK9YALS/V9qTGe5s2zLQgKeu3ma+S3jyTw 4XHq/BBIqfeeUJvPJIa4A6oJwWXCo60fglfvdBYeoYkSMhKwpJ PNTUO2jo9DA+jcoMEXVzMcZPejwH8H/5TWyJccQvH+GhiaBL48 wwp/c2puc5FjnsGTHTfuuw4IUDs2Crh1xew+i5UpCV7vPW43HZ lHVQP86PeaC8EggpZ8JcuIfJ5chGLph9C/UcsUAGSKZyss4CXH JHRYgD/LiqcZo7aZwuJ8TCFHRAkeZvxT6TvW4GLsS6wiGYkkMl QKtLKMugl3m/zLDs4P8D+gwyC9J0y6tEPA55qCOBh5RX9IeZWm +Hf6ZStLAAJfVlRxAB6Zdo0KEbsTP5TcsdBetRGwJ X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11809 Cc: 11809@debbugs.gnu.org, jidanni@jidanni.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 06/29/2012 10:48 AM, Jim Meyering wrote: > Here's the doc patch I suggested, but I'll hold off for now. > I'd like to hear if anyone thinks it's worth adding a new option, > which would obviate such a script. I think it's okay, that special backup case is described in the info page of cp twice anyway. > diff --git a/doc/coreutils.texi b/doc/coreutils.texi > index 08ef2d8..5207c44 100644 > --- a/doc/coreutils.texi > +++ b/doc/coreutils.texi > @@ -7675,9 +7675,11 @@ cp invocation > #!/bin/sh > # Usage: backup FILE... > # Create a @sc{gnu}-style backup of each listed FILE. > +fail=0 > for i; do > - cp --backup --force -- "$i" "$i" > + cp --backup --force -- "$i" "$i" || fail=1 > done > +exit $fail > @end example > > @item --copy-contents When we speak of "backup", then maybe "--preserve=all" would be nice. BTW: that special backup case accepts -a which includes both -d and -R which both are maybe not ideal if you speak about a backup of a regular file. The former treats symlinks specially, and the latter is designed to recurse into directories - both may be misleading (although -d may make some sense in certain situation when creating a backup of a symlink). WDYT? Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 29 06:26:23 2012 Received: (at 11809) by debbugs.gnu.org; 29 Jun 2012 10:26:24 +0000 Received: from localhost ([127.0.0.1]:36445 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkYP9-00085N-4c for submit@debbugs.gnu.org; Fri, 29 Jun 2012 06:26:23 -0400 Received: from mx.meyering.net ([88.168.87.75]:53380) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkYP6-00085E-Kx for 11809@debbugs.gnu.org; Fri, 29 Jun 2012 06:26:21 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 2718F6011B; Fri, 29 Jun 2012 12:22:01 +0200 (CEST) From: Jim Meyering To: Bernhard Voelker Subject: Re: bug#11809: document "So how do we just simply make a backup file?" In-Reply-To: <4FED75BE.5050004@bernhard-voelker.de> (Bernhard Voelker's message of "Fri, 29 Jun 2012 11:30:38 +0200") References: <87hatv4fnw.fsf@jidanni.org> <87ehozs9wk.fsf@rho.meyering.net> <87vciapkpt.fsf@rho.meyering.net> <4FED75BE.5050004@bernhard-voelker.de> Date: Fri, 29 Jun 2012 12:22:01 +0200 Message-ID: <87pq8ipgdy.fsf@rho.meyering.net> Lines: 43 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11809 Cc: 11809@debbugs.gnu.org, jidanni@jidanni.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Bernhard Voelker wrote: > On 06/29/2012 10:48 AM, Jim Meyering wrote: >> Here's the doc patch I suggested, but I'll hold off for now. >> I'd like to hear if anyone thinks it's worth adding a new option, >> which would obviate such a script. > > I think it's okay, that special backup case is described in the info > page of cp twice anyway. > >> diff --git a/doc/coreutils.texi b/doc/coreutils.texi >> index 08ef2d8..5207c44 100644 >> --- a/doc/coreutils.texi >> +++ b/doc/coreutils.texi >> @@ -7675,9 +7675,11 @@ cp invocation >> #!/bin/sh >> # Usage: backup FILE... >> # Create a @sc{gnu}-style backup of each listed FILE. >> +fail=0 >> for i; do >> - cp --backup --force -- "$i" "$i" >> + cp --backup --force -- "$i" "$i" || fail=1 >> done >> +exit $fail >> @end example >> >> @item --copy-contents > > When we speak of "backup", then maybe "--preserve=all" would be nice. > > BTW: that special backup case accepts -a which includes both -d and -R > which both are maybe not ideal if you speak about a backup of a regular > file. The former treats symlinks specially, and the latter is designed > to recurse into directories - both may be misleading (although -d may > make some sense in certain situation when creating a backup of a > symlink). WDYT? Adding --preserve=all sounds like a good idea. Thanks. Allowing this little script to work also for non-regular files seems like it'd be useful, too. But it's beginning to look as if this combination of options is both useful and involved enough that the functionality should be provided by a new --only-backup option. From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 30 05:57:24 2012 Received: (at 11809) by debbugs.gnu.org; 30 Jun 2012 09:57:24 +0000 Received: from localhost ([127.0.0.1]:38624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkuQd-0005PL-Us for submit@debbugs.gnu.org; Sat, 30 Jun 2012 05:57:24 -0400 Received: from mx.meyering.net ([88.168.87.75]:56859) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SkuQa-0005PC-Tk for 11809@debbugs.gnu.org; Sat, 30 Jun 2012 05:57:22 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 1AA82601B6; Sat, 30 Jun 2012 11:52:57 +0200 (CEST) From: Jim Meyering To: Bernhard Voelker Subject: Re: bug#11809: document "So how do we just simply make a backup file?" In-Reply-To: <87pq8ipgdy.fsf@rho.meyering.net> (Jim Meyering's message of "Fri, 29 Jun 2012 12:22:01 +0200") References: <87hatv4fnw.fsf@jidanni.org> <87ehozs9wk.fsf@rho.meyering.net> <87vciapkpt.fsf@rho.meyering.net> <4FED75BE.5050004@bernhard-voelker.de> <87pq8ipgdy.fsf@rho.meyering.net> Date: Sat, 30 Jun 2012 11:52:57 +0200 Message-ID: <87wr2pnn2e.fsf@rho.meyering.net> Lines: 80 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11809 Cc: 11809@debbugs.gnu.org, jidanni@jidanni.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Jim Meyering wrote: > Bernhard Voelker wrote: >> On 06/29/2012 10:48 AM, Jim Meyering wrote: >>> Here's the doc patch I suggested, but I'll hold off for now. >>> I'd like to hear if anyone thinks it's worth adding a new option, >>> which would obviate such a script. >> >> I think it's okay, that special backup case is described in the info >> page of cp twice anyway. >> >>> diff --git a/doc/coreutils.texi b/doc/coreutils.texi >>> index 08ef2d8..5207c44 100644 >>> --- a/doc/coreutils.texi >>> +++ b/doc/coreutils.texi >>> @@ -7675,9 +7675,11 @@ cp invocation >>> #!/bin/sh >>> # Usage: backup FILE... >>> # Create a @sc{gnu}-style backup of each listed FILE. >>> +fail=0 >>> for i; do >>> - cp --backup --force -- "$i" "$i" >>> + cp --backup --force -- "$i" "$i" || fail=1 >>> done >>> +exit $fail >>> @end example >>> >>> @item --copy-contents >> >> When we speak of "backup", then maybe "--preserve=all" would be nice. >> >> BTW: that special backup case accepts -a which includes both -d and -R >> which both are maybe not ideal if you speak about a backup of a regular >> file. The former treats symlinks specially, and the latter is designed >> to recurse into directories - both may be misleading (although -d may >> make some sense in certain situation when creating a backup of a >> symlink). WDYT? > > Adding --preserve=all sounds like a good idea. > Thanks. > > Allowing this little script to work also for non-regular files > seems like it'd be useful, too. But it's beginning to look as if > this combination of options is both useful and involved enough that > the functionality should be provided by a new --only-backup option. I went ahead and pushed this: >From 5f6c22fceedd0d350e1a8246d4d73840de666c7e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 29 Jun 2012 10:45:31 +0200 Subject: [PATCH] doc: improve sample backup script * doc/coreutils.texi (cp invocation): Make the backup script exit with an accurate reflection of any failure. Also, add --preserve=all. Improved-by: Bernhard Voelker --- doc/coreutils.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 08ef2d8..954a1f8 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -7675,9 +7675,11 @@ cp invocation #!/bin/sh # Usage: backup FILE... # Create a @sc{gnu}-style backup of each listed FILE. +fail=0 for i; do - cp --backup --force -- "$i" "$i" + cp --backup --force --preserve=all -- "$i" "$i" || fail=1 done +exit $fail @end example @item --copy-contents -- 1.7.11.1.104.ge7b44f1 From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 15 13:17:46 2018 Received: (at control) by debbugs.gnu.org; 15 Oct 2018 17:17:46 +0000 Received: from localhost ([127.0.0.1]:51134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gC6V0-0006gC-4k for submit@debbugs.gnu.org; Mon, 15 Oct 2018 13:17:46 -0400 Received: from mail-io1-f48.google.com ([209.85.166.48]:36001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gC6Uy-0006ca-Dd for control@debbugs.gnu.org; Mon, 15 Oct 2018 13:17:44 -0400 Received: by mail-io1-f48.google.com with SMTP id p4-v6so14773880iom.3 for ; Mon, 15 Oct 2018 10:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=vyLWcjBGo0/gWaeOMflmC5LTVa0K29Vfi2SOlEHcduk=; b=XKFb3Ao4Z7r2y5ket14FrwDZ9pgXVoHJNYv4WYjxLCOTQWGK7ihFf68sKTgKo0qSOw gQLPhrWCoSEXEJw/WXzXhNjag5zoz1Hf6lovhvMa6ZJRpskHlTqLMwlR/R63SLOCaHjd m8f4Egn66eWPeb+1SHjhjNURP84j+kgsLuS/ocT4JRGxntSATaaqtZRf8zor4l76EplQ GZ+oWjWzmQUF0htUuO0ONrJ/I+udXvJTJsqLJYp6TXZUxob++vUtnEViWQJyP4PH5LC8 /8cdwqL2RCf9gSOY4p+7xTI9y7iNBjVlT2Ke4o/C+ll5TgYKYCXlfw6Kt4dYS/odFWhu LVwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=vyLWcjBGo0/gWaeOMflmC5LTVa0K29Vfi2SOlEHcduk=; b=ACiNNpVx4uFWjbAEH65LNvxlFuxpGalt4CVUScWmo0cW/0uL1Jd+w3F699srRayyuS VXDv0HK/mEvnoppozZusP+IYIOHHqqdN/JvZVceOLhIpfvnKFp8aPuwjbeiQe3D9m3Id J2gJZMqAVU3ycISquHCVnRwWddQa99QaUBu0lshRh0hY8owFGxMUYf0qJj5J3o37q3Rd 2a/vdPl6UfMqtz0VOotbDHnP9MAr+6uCDyruWQHIzPj2rJJPoQDOpM1YhrTlrSE0y9wO OI1VrRTsCA3zch7IsDH8PNjCe/fi/lmy/jBanxjRj0rbxNZrXf1iPlRBms1K7kV0pMaf nxgA== X-Gm-Message-State: ABuFfohcY2ln8loUnv+anO2jJ1wyLkDT6rl5zEEAH7awVCFsJHVNBzwi PkAA/vXpawdDK4cV1X3/yHcDjZHDTZk= X-Google-Smtp-Source: ACcGV60ZzmZ7tvMsdWLWthqGhIsWWzUIO3Smgmc+k0OVwmTTz9a52G0sCjFK9jWSYIOssvv8ay4Lxg== X-Received: by 2002:a6b:5401:: with SMTP id i1-v6mr10512363iob.96.1539623858459; Mon, 15 Oct 2018 10:17:38 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id a136-v6sm4505119ita.6.2018.10.15.10.17.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 10:17:37 -0700 (PDT) To: control@debbugs.gnu.org From: Assaf Gordon Message-ID: <6776ab15-1282-0c77-3f67-2cef281922bd@gmail.com> Date: Mon, 15 Oct 2018 11:17:35 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.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: tags 11809 fixed close 11809 severity 11854 wishlist retitle 11854 maint: fix "make syntax-check -j" issue severity 11903 wishlist retitle 11903 multibyte: doc: fold should mention what happens if the command is used on multibyte characters [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.166.48 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject 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: 1.0 (+) tags 11809 fixed close 11809 severity 11854 wishlist retitle 11854 maint: fix "make syntax-check -j" issue severity 11903 wishlist retitle 11903 multibyte: doc: fold should mention what happens if the command is used on multibyte characters From unknown Mon Aug 18 08:56:18 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 13 Nov 2018 12: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