Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Any way to allow clobbering empty files when noclobber is set?



On Fri, Jun 5, 2020 at 9:48 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Bart Schaefer wrote on Fri, 05 Jun 2020 18:07 -0700:
> >  - how to identify the file we opened, in case something else renamed
> > or removed it, and created another one of the same name in the
> > meantime
> >
> > That seems at least impractical, especially the last one.
>
> It'll just be a couple of local variables on the C stack, won't it?

That would only work for jobs that run synchronously.  It has to be in
the fdtable or the job table or something for background jobs and
pipelines.

> > Open could fail because of file permissions.  Unlink depends only on
> > directory permissions.
>
> Well, yes, but usually, if you don't have permission to read a file,
> in practice you won't have permission to delete it either.

I think you mean "write" there, but actually you might be able to
write to an empty file that you can't delete, but not create a file
that you can't delete.



Messages sorted by: Reverse Date, Date, Thread, Author