From unknown Mon Jun 23 22:03:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20083: --follow-symlink shouldn't exists Resent-From: Nicolas Michel Original-Sender: "Debbugs-submit" Resent-CC: bug-sed@gnu.org Resent-Date: Wed, 11 Mar 2015 16:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20083 X-GNU-PR-Package: sed X-GNU-PR-Keywords: To: 20083@debbugs.gnu.org X-Debbugs-Original-To: bug-sed@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.142609040910864 (code B ref -1); Wed, 11 Mar 2015 16:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Mar 2015 16:13:29 +0000 Received: from localhost ([127.0.0.1]:42983 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YVjGC-0002pA-UQ for submit@debbugs.gnu.org; Wed, 11 Mar 2015 12:13:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58288) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YVh5u-0007U7-VE for submit@debbugs.gnu.org; Wed, 11 Mar 2015 09:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVh5o-0001cW-Lp for submit@debbugs.gnu.org; Wed, 11 Mar 2015 09:54:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVh5o-0001cS-J3 for submit@debbugs.gnu.org; Wed, 11 Mar 2015 09:54:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVh5k-0001s2-KE for bug-sed@gnu.org; Wed, 11 Mar 2015 09:54:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVh5e-0001YX-Li for bug-sed@gnu.org; Wed, 11 Mar 2015 09:54:32 -0400 Received: from mail-oi0-x22c.google.com ([2607:f8b0:4003:c06::22c]:38382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVh5e-0001YT-Gt for bug-sed@gnu.org; Wed, 11 Mar 2015 09:54:26 -0400 Received: by oiax69 with SMTP id x69so7873078oia.5 for ; Wed, 11 Mar 2015 06:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=DOrqbr+RQSGdXLXYy7kdd/qV8Pf7JjO9nd/700HOqro=; b=Yh9mWURNQwIni7KX9CWt0oOReKYsgE/oquUGZPK6nz6qr889JLb+glxayKxZ5x7xID 5IDxe0ZPAr63dF13HBiFJGmIT/FFTlcDNvcwoXwe4GGJO2nlVygWwc0P0IOu1Lqxxqcf t5/HGlpHk7MAmmYxCPlDc9Qo/HvNJ15cS9Qm7OH7k2jwZAp5u03JyMRaFUd+X1vk/MB8 kk4ty6AdmH4aMX/ydClDUay92o6Enrfl77UYrpLwpD07Xyq+/lnT6PAscrMiqbKVwLz9 gzXLY/dy823l4+q+/z6bIWzuzqMRj04z0l2hrzF0AGuh+CaOB5O+f5Q7VqhYMrqmMVp8 V2Cg== MIME-Version: 1.0 X-Received: by 10.182.76.69 with SMTP id i5mr26567951obw.19.1426082065601; Wed, 11 Mar 2015 06:54:25 -0700 (PDT) Received: by 10.60.82.233 with HTTP; Wed, 11 Mar 2015 06:54:25 -0700 (PDT) Date: Wed, 11 Mar 2015 14:54:25 +0100 Message-ID: From: Nicolas Michel Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Wed, 11 Mar 2015 12:13:26 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -4.0 (----) Hello, I'm a senior sysadmin. I realized recently that newest version of sed used with "-i" on a symlink would wipe the symlink and replace it by a plain file. Searching the net, I found some bug reports on some distros (bug 820149 on RedHat). And the bug has been "fixed" adding a --follow-symlink option. And the world seems to agree with it. I don't and I'll try to explain my point of view. sed is used to alter the __content__ of a file. I don't expect it to alter the permissions or the nature of the file itself (wich is not related to content but to file system). At best it can be harmless to the system. At worst, it can provokes system malfunction (try to "sed -i" /etc/grub.conf which is supposed to be a symlink of /boot/grub/grub.conf on a RHEL6). Adding --follow-symlink is: - only interesting when you know that sed -i replace a symlink by a file in the first place - only interesting if you know that this option exists - only interesting if you know in advance that the file you're suppose to change __is__ a symlink - is a lot of characters to type down It is a lot of conditions. The reality is that peoples usually don't realize it before a malfunction, and as I said. The last reason (and not the less) is that sed used not to alter a symlink in older releases!!! So: 1) because it is not the expected behavior of sed to change the nature of a file 2) because if can cause malfunction to the system 3) because --follow-symlink is a bad workaround 4) because it was not the behavior of sed in older releases I'm asking to suppress --follow-symlink (or keep it for compatibility purpose) and makes sed safe with the metadata and/or nature of a file (and keep a symlink a symlink). I hope you'll agree with my point of view ;) -- Nicolas MICHEL From unknown Mon Jun 23 22:03:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Nicolas Michel Subject: bug#20083: closed (Re: --follow-symlink shouldn't exists) Message-ID: References: X-Gnu-PR-Message: they-closed 20083 X-Gnu-PR-Package: sed Reply-To: 20083@debbugs.gnu.org Date: Tue, 05 May 2015 04:54:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1430801642-10211-1" This is a multi-part message in MIME format... ------------=_1430801642-10211-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #20083: --follow-symlink shouldn't exists which was filed against the sed package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 20083@debbugs.gnu.org. --=20 20083: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20083 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1430801642-10211-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 20083-done) by debbugs.gnu.org; 5 May 2015 04:53:26 +0000 Received: from localhost ([127.0.0.1]:34231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YpUrF-0002dw-RA for submit@debbugs.gnu.org; Tue, 05 May 2015 00:53:26 -0400 Received: from mail-oi0-f44.google.com ([209.85.218.44]:34533) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YpUrD-0002de-BJ for 20083-done@debbugs.gnu.org; Tue, 05 May 2015 00:53:23 -0400 Received: by oiko83 with SMTP id o83so129686943oik.1 for <20083-done@debbugs.gnu.org>; Mon, 04 May 2015 21:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:content-type; bh=eSUcASOkhIvf8MhpyvJ9duifsodGY3N4dSsznhdn7UI=; b=Ipe5abmahwr+aBFA1cwEdfvppAVonJrogPhZrHFpdZPYD5HoptibvoMNr0u0XDM+gU GMmV6lzyNAsJ+2VhRufiGoeTvsg/CqjrRI5/2ZkAkPuQsFDJ4skDvF12VL5rW4lbf61V IoVYHjZ4dAv9fUPNnNk3T/iMzhIda/NPnIkYNMgfb0us7qzXTKbdVF4bf8XXhVX/2DQY HN6jA6PsVii/zPa5H709wfLb4Z+w9gkViZVH1BF75uBemRoQrqTSdrP2zVzKWdWUzYrm ajlZByS5631NbXtvdJuwIbcI1LS5Y2oPtpVk49TMIbBUZ3diKSuy8C9rsxriN+G+P4Fo HIow== X-Received: by 10.50.127.232 with SMTP id nj8mr153500igb.32.1430801597538; Mon, 04 May 2015 21:53:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.62.229 with HTTP; Mon, 4 May 2015 21:52:57 -0700 (PDT) From: Jim Meyering Date: Mon, 4 May 2015 21:52:57 -0700 X-Google-Sender-Auth: RHu2C3zwr3w5cOG2yhv1NbeJtME Message-ID: Subject: Re: --follow-symlink shouldn't exists To: 20083-done@debbugs.gnu.org, Nicolas Michel Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 20083-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.7 (/) tag 20083 notabug thanks > I'm a senior sysadmin. I realized recently that newest version of sed > used with "-i" on a symlink would wipe the symlink and replace it by a > plain file. Searching the net, I found some bug reports on some > distros (bug 820149 on RedHat). And the bug has been "fixed" adding a > --follow-symlink option. And the world seems to agree with it. I don't > and I'll try to explain my point of view. > > sed is used to alter the __content__ of a file. I don't expect it to > alter the permissions or the nature of the file itself (wich is not > related to content but to file system). At best it can be harmless to > the system. At worst, it can provokes system malfunction (try to "sed > -i" /etc/grub.conf which is supposed to be a symlink of > /boot/grub/grub.conf on a RHEL6). > > Adding --follow-symlink is: > - only interesting when you know that sed -i replace a symlink by a > file in the first place > - only interesting if you know that this option exists > - only interesting if you know in advance that the file you're suppose > to change __is__ a symlink > - is a lot of characters to type down > > It is a lot of conditions. The reality is that peoples usually don't > realize it before a malfunction, and as I said. > > The last reason (and not the less) is that sed used not to alter a > symlink in older releases!!! > > So: > 1) because it is not the expected behavior of sed to change the nature of a file > 2) because if can cause malfunction to the system > 3) because --follow-symlink is a bad workaround > 4) because it was not the behavior of sed in older releases > I'm asking to suppress --follow-symlink (or keep it for compatibility > purpose) and makes sed safe with the metadata and/or nature of a file > (and keep a symlink a symlink). > > I hope you'll agree with my point of view ;) Thanks for writing, but this is not a bug. sed's --in-place (-i) option has always operated that way, replacing a symlink with a regular file. GNU sed began providing that option in October of 2002. The option was modeled after perl's -i option, which also works that way. You mention that typing the long option name, --follow-symlink, is burdensome. Fortunately, you can abbreviate it as "--fo". I'm marking this auto-created "issue" as closed, but you're welcome to continue the discussion. ------------=_1430801642-10211-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Mar 2015 16:13:29 +0000 Received: from localhost ([127.0.0.1]:42983 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YVjGC-0002pA-UQ for submit@debbugs.gnu.org; Wed, 11 Mar 2015 12:13:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58288) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YVh5u-0007U7-VE for submit@debbugs.gnu.org; Wed, 11 Mar 2015 09:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVh5o-0001cW-Lp for submit@debbugs.gnu.org; Wed, 11 Mar 2015 09:54:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVh5o-0001cS-J3 for submit@debbugs.gnu.org; Wed, 11 Mar 2015 09:54:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVh5k-0001s2-KE for bug-sed@gnu.org; Wed, 11 Mar 2015 09:54:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVh5e-0001YX-Li for bug-sed@gnu.org; Wed, 11 Mar 2015 09:54:32 -0400 Received: from mail-oi0-x22c.google.com ([2607:f8b0:4003:c06::22c]:38382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVh5e-0001YT-Gt for bug-sed@gnu.org; Wed, 11 Mar 2015 09:54:26 -0400 Received: by oiax69 with SMTP id x69so7873078oia.5 for ; Wed, 11 Mar 2015 06:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=DOrqbr+RQSGdXLXYy7kdd/qV8Pf7JjO9nd/700HOqro=; b=Yh9mWURNQwIni7KX9CWt0oOReKYsgE/oquUGZPK6nz6qr889JLb+glxayKxZ5x7xID 5IDxe0ZPAr63dF13HBiFJGmIT/FFTlcDNvcwoXwe4GGJO2nlVygWwc0P0IOu1Lqxxqcf t5/HGlpHk7MAmmYxCPlDc9Qo/HvNJ15cS9Qm7OH7k2jwZAp5u03JyMRaFUd+X1vk/MB8 kk4ty6AdmH4aMX/ydClDUay92o6Enrfl77UYrpLwpD07Xyq+/lnT6PAscrMiqbKVwLz9 gzXLY/dy823l4+q+/z6bIWzuzqMRj04z0l2hrzF0AGuh+CaOB5O+f5Q7VqhYMrqmMVp8 V2Cg== MIME-Version: 1.0 X-Received: by 10.182.76.69 with SMTP id i5mr26567951obw.19.1426082065601; Wed, 11 Mar 2015 06:54:25 -0700 (PDT) Received: by 10.60.82.233 with HTTP; Wed, 11 Mar 2015 06:54:25 -0700 (PDT) Date: Wed, 11 Mar 2015 14:54:25 +0100 Message-ID: Subject: --follow-symlink shouldn't exists From: Nicolas Michel To: bug-sed@gnu.org Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 11 Mar 2015 12:13:26 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -4.0 (----) Hello, I'm a senior sysadmin. I realized recently that newest version of sed used with "-i" on a symlink would wipe the symlink and replace it by a plain file. Searching the net, I found some bug reports on some distros (bug 820149 on RedHat). And the bug has been "fixed" adding a --follow-symlink option. And the world seems to agree with it. I don't and I'll try to explain my point of view. sed is used to alter the __content__ of a file. I don't expect it to alter the permissions or the nature of the file itself (wich is not related to content but to file system). At best it can be harmless to the system. At worst, it can provokes system malfunction (try to "sed -i" /etc/grub.conf which is supposed to be a symlink of /boot/grub/grub.conf on a RHEL6). Adding --follow-symlink is: - only interesting when you know that sed -i replace a symlink by a file in the first place - only interesting if you know that this option exists - only interesting if you know in advance that the file you're suppose to change __is__ a symlink - is a lot of characters to type down It is a lot of conditions. The reality is that peoples usually don't realize it before a malfunction, and as I said. The last reason (and not the less) is that sed used not to alter a symlink in older releases!!! So: 1) because it is not the expected behavior of sed to change the nature of a file 2) because if can cause malfunction to the system 3) because --follow-symlink is a bad workaround 4) because it was not the behavior of sed in older releases I'm asking to suppress --follow-symlink (or keep it for compatibility purpose) and makes sed safe with the metadata and/or nature of a file (and keep a symlink a symlink). I hope you'll agree with my point of view ;) -- Nicolas MICHEL ------------=_1430801642-10211-1--