GNU bug report logs - #63833
sed -iSUFFIX/--in-place=SUFFIX doesn't work for absolute paths if the input file(s) is not in the current directory.

Previous Next

Package: sed;

Reported by: Sebastian Carlos <sebaaa1754 <at> gmail.com>

Date: Fri, 2 Jun 2023 09:31:02 UTC

Severity: normal

To reply to this bug, email your comments to 63833 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-sed <at> gnu.org:
bug#63833; Package sed. (Fri, 02 Jun 2023 09:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sebastian Carlos <sebaaa1754 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Fri, 02 Jun 2023 09:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sebastian Carlos <sebaaa1754 <at> gmail.com>
To: bug-sed <at> gnu.org
Subject: sed -iSUFFIX/--in-place=SUFFIX doesn't work for absolute paths if the
 input file(s) is not in the current directory.
Date: Fri, 2 Jun 2023 11:30:25 +0200
[Message part 1 (text/plain, inline)]
Environment: Arch, GNU sed version 4.9, Bash 5.1.16

Given the following:

$ mkdir test
$ cat << 'EOF' > test/shopping-list
- GNUtella (1 jar)
- GNUpcakes (12 pieces)
- GNUsabi (100 g)
- Bash potatoes (2 kg)
- Sed-a cheese (200 g)
EOF

Attempting backup to an absolute path fails with an obscure error:

$ sed --in-place=/var/tmp/*.bak 's/1 jar/2 jars/' test/shopping-list
sed: cannot rename test/shopping-list: No such file or directory

But it works if the input file is in the current directory:

$ cd test
$ sed --in-place=/var/tmp/*.bak 's/1 jar/2 jars/' shopping-list
$ diff /var/tmp/shopping-list.bak shopping-list
1c1
< - GNUtella (1 jar)
---
> - GNUtella (2 jars)

Thanks!
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 157 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.