tech-kern archive

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

re: ARM pmap



Michael writes:
> Hello,
> 
> On Fri, 16 Jun 2017 14:30:18 +1000
> matthew green <mrg%eterna.com.au@localhost> wrote:
> 
> > > Or just tar xpzf ... - ours at least unlinks files before writing them,
> > > install(1) instead of cp(1) for single files.  
> > 
> > FWIW, it's temp file + rename, not unlink.
> 
> Hmm, the man page says:
>      --unlink      Ignored, only accepted for compatibility with other tar
>                    implementations.  tar always unlinks files before creating
>                    them.
> 
> ... which would make no sense if it was about creating new files.

this is actually false :-)  see eg pax/file_subs.c:

234         /*
235          * Finally, now the temp file is fully instantiated rename it to
236          * the desired file name.
237          */
238         if (rename(tmp_name, arcn->name) < 0) {
239                 syswarn(0, errno, "Cannot rename %s to %s",
240                     tmp_name, arcn->name);
241                 (void)unlink(tmp_name);
242         }

the idea being that you (a) get a new inode and don't overwrite
running text and (b) atomically switch to the new file so there
is no period that lookup will return ENOENT.

wanna fix the man for us? :)


.mrg.


Home | Main Index | Thread Index | Old Index