Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!tecate.mips.com!trevc From: trevc@tecate.mips.com (Trevor Cotton) Newsgroups: comp.sys.mips Subject: Re: RISC/os 4.5[12] (and probably earlier) cpio bug Message-ID: <2862@spim.mips.COM> Date: 1 May 91 02:06:29 GMT References: <2368@cluster.cs.su.oz.au> Sender: news@mips.COM Reply-To: trevc@mips.com Organization: Mips Computer Systems Inc., Sunnyvale, CA Lines: 48 Nntp-Posting-Host: tecate.mips.com In article <2368@cluster.cs.su.oz.au>, bruce@cs.su.oz (Bruce Janson) writes: |> Summary: |> "cpio -pdm" sometimes fails to create empty directories. |> |> Repeat by: |> $ uname -a |> joyce joyce 4_52 UMIPS mips |> $ id |> uid=0(root) gid=0(root) |> $ cd /tmp; mkdir t f f/a f/a/b; cd f |> $ find . -depth -print | cpio -pdm ../t |> cpio: WARNING: Cannot change the mode of file "../t/a/b" to 16877. |> cpio: WARNING: Cannot change owner to 0 and group to 0 for file "../t/a/b". |> 0 blocks |> $ Because the -depth option to find is used, cpio will be fed ./a/b and then ./a Because the -d option to cpio is used, it will try and create the needed directory 'a' first. The problem is that cpio is doing a if (!mkdir(namep, df_mode)) { When trying to create the directory ../t/a mkdir returns 0 on success, -1 on failure which means that cpio thinks it managed to create the directory when it did not. The reason it gives the "Cannot change the mode of file "../t/a/b" to 16877." error message is actually because ../t/a/b does not exist. Changing the offending line of code to if (mkdir(namep, df_mode) == -1) { cures the problem. I will make sure that a bug report is submitted so that we can get this fixed in the next release. -- --trevc-- Trevor Cotton, Sustaining Engineering, MIPS Computer Systems Inc. MS 6-05, 930 DeGuigne Drive, Sunnyvale, CA 94088-3650 Tel: +1 408 524 7286 Fax: +1 408 524 7521 Email: {wyse,ames,decwrl,pyramid}!mips!trevc trevc@mips.com