<div dir="ltr">Right now cpio ignores the "-u" flag. (-u: Copy unconditionally (normally, an older file will not replace a newer file with the same name).)<div><br></div><div>For directories, it behaves like "-u" is not specified, and for regular files, symlinks, devnode it behaves like "-u" is specified (sort of..) </div><div><br></div><div>$ mkdir a</div><div>$ touch a/b</div><div>$ find a | cpio -o -H newc >a.cpio</div><div>$ # at this point, a and a/b still exist</div><div>$ cpio -i <a.cpio</div><div>cpio: a: File exists<br></div><div>$ echo $?</div><div>1</div><div><br></div><div>* EEXIST for a. This is behaving like "-u" not specified, so not replacing existing file/path</div><div>* no error for extracting a/b, albeit a/b already exists. This is like "-u" is specified.</div><div>* toybox cpio returns with non-zero exit status.</div><div><br></div><div>Should we (1) make "-u" the default behavior of toybox, and not print an error when "a" already exists?</div><div><div>Or (2) we make "-u" a real option, and toybox would only overwrite existing files if "-u"? (that is, "-u" would need to be specified explicitly to get the current behavior)</div><div><br></div><div>Another question is, if we go (2), how do we handle existing files for the non-"-u" case?</div><div>(2.1) Do we just skip the file and print an EEXIST message?</div><div>Or (2.2) do we check the timestamp like what GNU did?</div><div>I think for simplicity (in terms of feature and code size), we should just go (1). But for SUSv2 compatibility we should do (2), at least (2.1).</div><div>I have a WIP patch for (2.1), but I'd like to discuss this before moving this forward.</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><table width="90%" border="0" cellspacing="0" cellpadding="0" style="margin:0px;padding:0px;font-family:"Times New Roman";max-width:348px"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td style="padding:0px"><table border="0" cellspacing="0" cellpadding="0" style="margin:0px;padding:20px 0px 0px"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td valign="top" style="padding:0px 20px 0px 0px;vertical-align:top;border-right:1px solid rgb(213,213,213)"><img src="https://i.imgur.com/eGpkLls.png" width="200" height="64"><br></td><td style="padding:0px 0px 0px 20px"><table border="0" cellspacing="0" cellpadding="0" style="margin:0px;padding:0px"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td colspan="2" style="font-family:Arial,Helvetica,Verdana,sans-serif;padding:1px 0px 5px;font-size:13px;line-height:13px;color:rgb(56,58,53);font-weight:700">Yi-yo Chiang</td></tr><tr style="margin:0px;padding:0px"><td colspan="2" style="font-family:Arial,Helvetica,Verdana,sans-serif;padding:0px 0px 5px;font-size:11px;line-height:13px;color:rgb(56,58,53)">Software Engineer</td></tr><tr style="margin:0px;padding:0px"><td colspan="2" style="font-family:Arial,Helvetica,Verdana,sans-serif;padding:0px 0px 5px;font-size:11px;line-height:13px;color:rgb(56,58,53)"><a href="mailto:yochiang@google.com" target="_blank" class="cremed">yochiang@google.com</a></td></tr><tr style="margin:0px;padding:0px"><td colspan="2" style="font-family:Arial,Helvetica,Verdana,sans-serif;padding:0px 0px 3px;font-size:11px;line-height:13px;color:rgb(3,112,248)"></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></div></div></div></div>