Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Staging:A
sed
sed-follow-symlinks-hyphen.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File sed-follow-symlinks-hyphen.patch of Package sed
This is a backport of the fix itself. From c033bdee411128dfebfea1974d1ee3c1d9eac572 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@fb.com> Date: Sat, 20 Jun 2015 07:38:49 -0700 Subject: [PATCH] sed -i: do not treat "-" as a file name Most GNU utilities treat "-" as standard input, sed itself does that -- in most contexts. However, since the addition of support for --in-place (-i) in sed-4.0, sed -i has treated a "-" argument as a file name, i.e., like ./-. Now, that usage evokes a diagnostic: $ sed -i s/a/b/ - sed: couldn't edit -: is a terminal If you require the old behavior, specify the file name as "./-". Prompted by the report/patch from Stanislav Brabec in http://bugs.gnu.org/20796 to document the strangely inconsistent legacy behavior. * sed/execute.c (open_next_file): Call panic before even attempting to operate on the file descriptor. * testsuite/in-place-hyphen.sh: New file. Test for this. * testsuite/Makefile.am (T): Add it. * NEWS (Feature removal): Mention it. Admittedly, the old behavior feels more like a misfeature. --- NEWS | 3 +++ sed/execute.c | 5 ++++- testsuite/Makefile.am | 1 + testsuite/in-place-hyphen.sh | 29 +++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 testsuite/in-place-hyphen.sh Index: sed-4.2.2/sed/execute.c =================================================================== --- sed-4.2.2.orig/sed/execute.c +++ sed-4.2.2/sed/execute.c @@ -580,8 +580,11 @@ open_next_file(name, input) { buffer.length = 0; - if (name[0] == '-' && name[1] == '\0' && !in_place_extension) + if (name[0] == '-' && name[1] == '\0') { + if (in_place_extension) + panic(_("couldn't edit %s: is a terminal"), name); + clearerr(stdin); /* clear any stale EOF indication */ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(MSDOS) || defined(__EMX__) input->fp = ck_fdopen (fileno (stdin), "stdin", read_mode, false);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor