develooper Front page | perl.perl5.porters | Postings from July 2016

[perl #24000] perl -pi -e s:foo:foo2: FILE mishandles symlinks?

Tony Cook via RT
July 5, 2016 23:50
[perl #24000] perl -pi -e s:foo:foo2: FILE mishandles symlinks?
Message ID:
On Tue Jul 05 15:47:08 2016, wrote:
> Confirmed 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.

According to its documentation, the default for GNU sed is to break the

     This option is available only on platforms that support symbolic
     links and has an effect only if option `-i' is specified.  In this
     case, if the file that is specified on the command line is a
     symbolic link, `sed' will follow the link and edit the ultimate
     destination of the link.  The default behavior is to break the
     symbolic link, so that the link destination will not be modified.

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.


via perlbug:  queue: perl5 status: open Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About