bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: awk inplace overrides symlinks


From: Andrew J. Schorr
Subject: Re: awk inplace overrides symlinks
Date: Thu, 8 Feb 2024 21:16:18 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Fri, Feb 09, 2024 at 12:28:54AM +0000, Avid Seeker wrote:
> ```
> touch file
> ln -s file link
> awk -i inplace '{print "newline"}' link
> ```
> 
> Results in replacing `link` with a regular file.

Thanks for the bug report. The code currently calls stat() to check whether
it's working on a regular file, and craps out if it isn't.  So arguably we
should be using lstat() and failing in this case instead of stomping on the
symlink.  Or do you expect the code to chase the link and replace the symlink
destination file? I think the latter is probably too much to ask...

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]