New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perl -pi -e s:foo:foo2: FILE mishandles symlinks? #6785
Comments
From pekkas@netcore.fiHi, On Red Hat Linux 7.3 and 9 (perl 5.6.1 and 5.8, respectively), at least, Smells very much like a bug..? The behaviour should be apparent from below: pekkas: /home/pekkas/perl$ echo test > unf2 -- |
From @rgarciaPekka Savola (via RT) wrote:
At first sight, I don't think perl should transparently follow symlinks. Note that you can force perl to follow symlinks by inserting at the top BEGIN { @ARGV = map { -l $_ ? readlink : $_ } @ARGV; } [You could even put this in a FollowSymlinks.pm file, to be loaded via |
From pekkas@netcore.fiOn 23 Sep 2003, Rafael Garcia-Suarez wrote:
I have to really, really disagree with you here. Consider what the script
.. right but this is really a bit too complex, and won't help those whose -- |
From @ysthOn Tue, Sep 23, 2003 at 03:23:46PM +0200, Rafael Garcia-Suarez <raphel.garcia-suarez@hexaflux.com> wrote:
Perhaps at least a warning for -i on a symlink?
Needs to recurse if readlink returns a symlink. |
From Robin.Barker@npl.co.uk
Robin -----Original Message----- On Tue, Sep 23, 2003 at 03:23:46PM +0200, Rafael Garcia-Suarez
Perhaps at least a warning for -i on a symlink?
Needs to recurse if readlink returns a symlink. This e-mail and any attachments may contain confidential and/or NPL Management Ltd cannot guarantee that the e-mail or any NPL Management Ltd. Registered in England and Wales. No: 2937881 |
From ajs@ajs.comOn Tue, 2003-09-23 at 13:08, Robin Barker wrote:
No, that way lies dragons. Perl should have some switch that at the * Rename old name to new name to the more complex: * Copy old file to new name There are sound technical reasons to do either one, but I *would* argue -- |
From @jkeenanOn Tue Sep 23 09:39:38 2003, pekkas@netcore.fi wrote:
This ticket has not attracted comments in about nine years. From Could someone give this ticket some attention and make a recommendation? Thank you very much. |
From @dcollinsnConfirmed in blead. I definitely thing this is a bug that needs to be repaired. At minimum, as suggested, I think a warning would be helpful when the target file is a symlink that is not being followed. After all, this is "like sed", as perl -h says. If you're following the link to read the file, you should also follow the link to write it. |
From @tonycozOn Tue Jul 05 15:47:08 2016, dcollinsn@gmail.com wrote:
According to its documentation, the default for GNU sed is to break the `--follow-symlinks' which is the behaviour I expected. (POSIX, BSD, Solaris sed don't seem to support in-place editing.) My work in progress in-place edit branch doesn't attempt to follow symlinks. Tony |
From @dcollinsnWell then, I suppose it is just my expectations that are defective. ;) Is On Tue, Jul 5, 2016 at 7:50 PM, Tony Cook via RT <perlbug-followup@perl.org>
|
From @tonycozOn Tue, Jul 05, 2016 at 08:14:11PM -0400, Dan Collins wrote:
From the -i documentation: Note that because B<-i> renames or deletes the original file before which might be re-worded or expanded on. Tony |
Migrated from rt.perl.org#24000 (status was 'open')
Searchable as RT24000$
The text was updated successfully, but these errors were encountered: