<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.CodeChar
{mso-style-name:"Code Char";
mso-style-link:Code;
font-family:"Courier New";
color:#FF5B09;
background:black;}
p.Code, li.Code, div.Code
{mso-style-name:Code;
mso-style-link:"Code Char";
margin-top:6.0pt;
margin-right:0cm;
margin-bottom:4.0pt;
margin-left:0cm;
mso-add-space:auto;
background:black;
font-size:10.0pt;
font-family:"Courier New";
color:#FF5B09;
mso-fareast-language:EN-US;}
p.CodeCxSpFirst, li.CodeCxSpFirst, div.CodeCxSpFirst
{mso-style-name:CodeCxSpFirst;
mso-style-link:"Code Char";
mso-style-type:export-only;
margin-top:6.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
mso-add-space:auto;
background:black;
font-size:10.0pt;
font-family:"Courier New";
color:#FF5B09;
mso-fareast-language:EN-US;}
p.CodeCxSpMiddle, li.CodeCxSpMiddle, div.CodeCxSpMiddle
{mso-style-name:CodeCxSpMiddle;
mso-style-link:"Code Char";
mso-style-type:export-only;
margin:0cm;
margin-bottom:.0001pt;
mso-add-space:auto;
background:black;
font-size:10.0pt;
font-family:"Courier New";
color:#FF5B09;
mso-fareast-language:EN-US;}
p.CodeCxSpLast, li.CodeCxSpLast, div.CodeCxSpLast
{mso-style-name:CodeCxSpLast;
mso-style-link:"Code Char";
mso-style-type:export-only;
margin-top:0cm;
margin-right:0cm;
margin-bottom:4.0pt;
margin-left:0cm;
mso-add-space:auto;
background:black;
font-size:10.0pt;
font-family:"Courier New";
color:#FF5B09;
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1108432899;
mso-list-type:hybrid;
mso-list-template-ids:1983439352 134807569 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
@list l0:level1
{mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi, I’ve fixed a couple of bugs in cpio.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When you run it as root CPIO is meant to set the uid and guid of files from information in the archive, but it currently doesn’t do this because of a couple of bugs:<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">1)<span style="font:7.0pt "Times New Roman"">
</span></span><![endif]>It’s looking at the wrong parts of the header<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">2)<span style="font:7.0pt "Times New Roman"">
</span></span><![endif]>The “Am I root?” test is coded as “getpid() == 0” rather than “geteuid() == 0”. It’s difficult to think of a realistic scenario where the former would be true!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">There may be people out there who are depending on the old, incorrect, behaviour, so I’ve also implemented a “--no-preserve-owner” option (as in GNU cpio) to re-enable this behaviour. This is separated out in the second patch, but I think
both patches need to be added at the same time.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">To test it I ran:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">cd /tmp && rm -rf s d && (mkdir s d && cp -a /dev/tty s && mkdir s/dir && touch s/file && chown test:system s/* && (cd s && ls | cpio -o > .s.cpio) && (cd d && cpio -i < ../s/.s.cpio) && (ls -l s ; ls -l d)) ; rm -rf /tmp/d<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Before the change I got:<o:p></o:p></p>
<p class="CodeCxSpFirst" style="background:white"><span style="font-size:11.0pt;color:windowtext">total 0
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">drwxr-xr-x 2 test system 40 1970-01-01 00:21 dir
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">-rw-r--r-- 1 test system 0 1970-01-01 00:21 file
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">crw-rw-rw- 1 test system 5, 0 1970-01-01 00:00 tty
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">total 0 <o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">drwxr-xr-x 2 root root 40 1970-01-01 00:21 dir
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">-rw-r--r-- 1 root root 0 1970-01-01 00:21 file
<o:p></o:p></span></p>
<p class="CodeCxSpLast" style="background:white"><span style="font-size:11.0pt;color:windowtext">crw-r--r-- 1 root root 0, 13 1970-01-01 00:00 tty
<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><o:p> </o:p></p>
<p class="MsoNormal" style="background:white">and afterwards:<o:p></o:p></p>
<p class="CodeCxSpFirst" style="background:white"><span style="font-size:11.0pt;color:windowtext">total 0
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">drwxr-xr-x 2 test system 40 1970-01-01 00:02 dir
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">-rw-r--r-- 1 test system 0 1970-01-01 00:02 file <o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">crw-rw-rw- 1 test system 5, 0 1970-01-01 00:00 tty
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">total 0
<o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">drwxr-xr-x 2 test system 40 1970-01-01 00:02 dir <o:p></o:p></span></p>
<p class="CodeCxSpMiddle" style="background:white"><span style="font-size:11.0pt;color:windowtext">-rw-r--r-- 1 test system 0 1970-01-01 00:02 file
<o:p></o:p></span></p>
<p class="CodeCxSpLast" style="background:white"><span style="font-size:11.0pt;color:windowtext">crw-r--r</span><span style="color:windowtext">-- 1 test system 5, 0 1970-01-01 00:00 tty
<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><o:p> </o:p></p>
<p class="MsoNormal" style="background:white">I also checked that --no-preserve-owner works as expected, and that non-root operation doesn’t preserve the ownership info.<o:p></o:p></p>
<p class="MsoNormal" style="background:white"><o:p> </o:p></p>
<p class="MsoNormal" style="background:white">Mike.<o:p></o:p></p>
<p class="MsoNormal" style="background:white"><o:p> </o:p></p>
<p class="MsoNormal" style="background:white"><o:p> </o:p></p>
<p class="MsoNormal" style="background:white"><o:p> </o:p></p>
</div>
<p> </p>
<p style="margin-bottom:12.0pt"><span style="font-size:9.0pt; font-family:"Arial","sans-serif";color:#666666;text-transform:uppercase;">Mike Moreton
</span><br>
<span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#EE7F00;text-transform:uppercase;">Software Project Leader</span><br>
<span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#666666;text-transform:uppercase;">Frontier Silicon Ltd</span><br>
</p>
<p><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#EE7F00">D</span>
<span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#666666">+44 1223 497780</span>
</p>
<p style="line-height:11.25pt"><span style="font-size:9.0pt; font-family:"Arial","sans-serif";color:#666666"><a href="http://www.frontier-silicon.com/" style="text-decoration:none;"><span style="color:#EE7F00;text-decoration:none;text-underline:none">www.frontier-silicon.com</span>
</a><br>
Ashwell Point, Babraham Road, Sawston, Cambridge, CB22 3LJ, UK </span></p>
<p style="line-height:11.25pt"><span style="font-size:7.0pt;font-family:"Arial","sans-serif"; color:#666666">Frontier Silicon Ltd is a Toumaz Group company (the Group also includes Sensium Healthcare and Frontier Microsystems), registered in England and Wales
- company no. 4213838. Registered address: 137 Euston Road, London, NW1 2AA </span>
</p>
</body>
</html>