From unknown Tue Jun 17 01:44:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11427: cp 8.16 not writing through, writing over Resent-From: karl@freefriends.org (Karl Berry) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 07 May 2012 13:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11427 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 11427@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13363968934207 (code B ref -1); Mon, 07 May 2012 13:22:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 May 2012 13:21:33 +0000 Received: from localhost ([127.0.0.1]:39305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SRNsb-00015n-7q for submit@debbugs.gnu.org; Mon, 07 May 2012 09:21:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49429) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SRNsY-00015Z-SL for submit@debbugs.gnu.org; Mon, 07 May 2012 09:21:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRNqQ-00028o-Vn for submit@debbugs.gnu.org; Mon, 07 May 2012 09:19:24 -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 autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:57894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRNqQ-00028d-SP for submit@debbugs.gnu.org; Mon, 07 May 2012 09:19:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRNqK-0005D0-Ks for bug-coreutils@gnu.org; Mon, 07 May 2012 09:19:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRNqF-00024V-JE for bug-coreutils@gnu.org; Mon, 07 May 2012 09:19:12 -0400 Received: from b0.f7.net ([66.148.120.132]:58502 helo=freefriends.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRNqF-00023s-9p for bug-coreutils@gnu.org; Mon, 07 May 2012 09:19:07 -0400 X-Envelope-From: karl@freefriends.org X-Envelope-To: Received: from freefriends.org (sls-af11p1.sea2.superbservers.com [127.0.0.1]) by freefriends.org (8.14.5/8.14.5) with ESMTP id q47DJ2Tp004999 for ; Mon, 7 May 2012 06:19:05 -0700 Received: (from nobody@localhost) by freefriends.org (8.14.5/8.14.5/submit) id q47DJ2C5004998; Mon, 7 May 2012 13:19:02 GMT Date: Mon, 7 May 2012 13:19:02 GMT Message-Id: <201205071319.q47DJ2C5004998@freefriends.org> X-Authentication-Warning: freefriends.org: nobody set sender to karl@freefriends.org using -f From: karl@freefriends.org (Karl Berry) 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-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 (------) Create dangling symlink: $ ln -s foo bar Attempt to write over it with cp: $ \cp -i /etc/issue bar cp: not writing through dangling symlink 'bar' In the past, it would ask me if I wanted to replace bar. (As desired.) The error message makes me think that it is thinking I am writing "through" a dangling symlink to a directory. But that gets a different error message, which seems fine: $ \cp -i /etc/issue bar/baz cp: cannot create regular file 'bar/baz': No such file or directory coreutils 8.16, compiled from original source on CentOS 5.8 (libc 2.5, it seems). karl From unknown Tue Jun 17 01:44:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11427: cp 8.16 not writing through, writing over Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 07 May 2012 17:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11427 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: karl@freefriends.org (Karl Berry) Cc: 11427@debbugs.gnu.org Received: via spool by 11427-submit@debbugs.gnu.org id=B11427.133641047424315 (code B ref 11427); Mon, 07 May 2012 17:08:01 +0000 Received: (at 11427) by debbugs.gnu.org; 7 May 2012 17:07:54 +0000 Received: from localhost ([127.0.0.1]:39769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SRRPe-0006K8-Hw for submit@debbugs.gnu.org; Mon, 07 May 2012 13:07:54 -0400 Received: from mx.meyering.net ([88.168.87.75]:46559) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SRRPc-0006K0-Om for 11427@debbugs.gnu.org; Mon, 07 May 2012 13:07:54 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id D644E60053; Mon, 7 May 2012 19:05:18 +0200 (CEST) From: Jim Meyering In-Reply-To: <201205071319.q47DJ2C5004998@freefriends.org> (Karl Berry's message of "Mon, 7 May 2012 13:19:02 GMT") References: <201205071319.q47DJ2C5004998@freefriends.org> Date: Mon, 07 May 2012 19:05:18 +0200 Message-ID: <8762c7exbl.fsf@rho.meyering.net> Lines: 49 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) 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 (-) Karl Berry wrote: > Create dangling symlink: > $ ln -s foo bar > > Attempt to write over it with cp: > $ \cp -i /etc/issue bar > cp: not writing through dangling symlink 'bar' > > In the past, it would ask me if I wanted to replace bar. (As desired.) Hi Karl, When I try that in an empty directory and using coreutils-6.7's cp (which predates the change mentioned below), it does this: $ ln -s foo bar $ env cp -i /etc/issue bar : cp: cannot create regular file `bar': File exists Maybe you want to use --backup? > The error message makes me think that it is thinking I am writing > "through" a dangling symlink to a directory. But that gets > a different error message, which seems fine: > $ \cp -i /etc/issue bar/baz > cp: cannot create regular file 'bar/baz': No such file or directory > > coreutils 8.16, compiled from original source on CentOS 5.8 (libc 2.5, > it seems). [quick answer: set POSIXLY_CORRECT] That behavior change dates back to 2007. Here's the NEWS snippet: * Noteworthy changes in release 6.9.90 (2007-12-01) [beta] ... ** Changes in behavior cp, by default, refuses to copy through a dangling destination symlink Set POSIXLY_CORRECT if you require the old, risk-prone behavior. There's more detail here: http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=2bdc48121916ab0d7bb7d and even more on the mailing list just before I made that change. From debbugs-submit-bounces@debbugs.gnu.org Tue May 08 15:51:18 2012 Received: (at control) by debbugs.gnu.org; 8 May 2012 19:51:19 +0000 Received: from localhost ([127.0.0.1]:41675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SRqRK-0007dR-IM for submit@debbugs.gnu.org; Tue, 08 May 2012 15:51:18 -0400 Received: from mx.meyering.net ([88.168.87.75]:50928) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SRqRI-0007dB-9K; Tue, 08 May 2012 15:51:17 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id AE3AE60095; Tue, 8 May 2012 21:49:03 +0200 (CEST) From: Jim Meyering To: 11427-done@debbugs.gnu.org Subject: Re: bug#11427: cp 8.16 not writing through, writing over In-Reply-To: <8762c7exbl.fsf@rho.meyering.net> (Jim Meyering's message of "Mon, 07 May 2012 19:05:18 +0200") References: <201205071319.q47DJ2C5004998@freefriends.org> <8762c7exbl.fsf@rho.meyering.net> Date: Tue, 08 May 2012 21:49:03 +0200 Message-ID: <87k40m4fo0.fsf@rho.meyering.net> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: control 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 (-) tags 11427 + notabug close 11427 thanks Jim Meyering wrote: ... > [quick answer: set POSIXLY_CORRECT] > > That behavior change dates back to 2007. > Here's the NEWS snippet: > > > * Noteworthy changes in release 6.9.90 (2007-12-01) [beta] > ... > ** Changes in behavior > > cp, by default, refuses to copy through a dangling destination symlink > Set POSIXLY_CORRECT if you require the old, risk-prone behavior. > > > There's more detail here: > > http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=2bdc48121916ab0d7bb7d > > and even more on the mailing list just before I made that change. Karl mentioned off-list that this can be closed.