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

Full log


View this message in rfc822 format

From: Sebastian Carlos <sebaaa1754 <at> gmail.com>
To: 63833 <at> debbugs.gnu.org
Subject: bug#63833: 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 2 years and 15 days ago.

Previous Next


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