* [PATCH] gen_init_cpio: remove leading `/' from file names
@ 2010-10-06 7:13 Thomas Chou
2010-10-06 14:51 ` Mike Frysinger
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Chou @ 2010-10-06 7:13 UTC (permalink / raw)
To: linux-kernel; +Cc: nios2-dev, Mike Frysinger, Thomas Chou
When we extracted the generated cpio archive using "cpio -id" command,
it complained,
cpio: Removing leading `/' from member names
var/run
cpio: Removing leading `/' from member names
var/lib
cpio: Removing leading `/' from member names
var/lib/misc
It is worse with the latest "cpio" or "pax", which tries to overwrite
the host file system with the leading '/'.
So the leading '/' of file names should be removed. This is consistent
with the initramfs come with major distributions such as Fedora or
Debian, etc.
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
usr/gen_init_cpio.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index b2b3c2d..59df70d 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -104,6 +104,8 @@ static int cpio_mkslink(const char *name, const char *target,
char s[256];
time_t mtime = time(NULL);
+ if (name[0] == '/')
+ name++;
sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
"%08X%08X%08X%08X%08X%08X%08X",
"070701", /* magic */
@@ -152,6 +154,8 @@ static int cpio_mkgeneric(const char *name, unsigned int mode,
char s[256];
time_t mtime = time(NULL);
+ if (name[0] == '/')
+ name++;
sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
"%08X%08X%08X%08X%08X%08X%08X",
"070701", /* magic */
@@ -245,6 +249,8 @@ static int cpio_mknod(const char *name, unsigned int mode,
else
mode |= S_IFCHR;
+ if (name[0] == '/')
+ name++;
sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
"%08X%08X%08X%08X%08X%08X%08X",
"070701", /* magic */
@@ -332,6 +338,8 @@ static int cpio_mkfile(const char *name, const char *location,
/* data goes on last link */
if (i == nlinks) size = buf.st_size;
+ if (name[0] == '/')
+ name++;
namesize = strlen(name) + 1;
sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
"%08lX%08X%08X%08X%08X%08X%08X",
--
1.7.1.86.g0e460
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gen_init_cpio: remove leading `/' from file names
2010-10-06 7:13 [PATCH] gen_init_cpio: remove leading `/' from file names Thomas Chou
@ 2010-10-06 14:51 ` Mike Frysinger
2010-11-18 2:52 ` Thomas Chou
0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2010-10-06 14:51 UTC (permalink / raw)
To: Thomas Chou; +Cc: linux-kernel, nios2-dev
On Wed, Oct 6, 2010 at 03:13, Thomas Chou wrote:
> When we extracted the generated cpio archive using "cpio -id" command,
> it complained,
>
> cpio: Removing leading `/' from member names
> var/run
> cpio: Removing leading `/' from member names
> var/lib
> cpio: Removing leading `/' from member names
> var/lib/misc
>
> It is worse with the latest "cpio" or "pax", which tries to overwrite
> the host file system with the leading '/'.
seems to work as intended on Blackfin systems, and i cant see any
reason to require the leading slash, so:
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gen_init_cpio: remove leading `/' from file names
2010-10-06 14:51 ` Mike Frysinger
@ 2010-11-18 2:52 ` Thomas Chou
2010-12-02 13:30 ` Michal Marek
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Chou @ 2010-11-18 2:52 UTC (permalink / raw)
To: Andrew Morton, Michal Marek; +Cc: Mike Frysinger, linux-kernel, nios2-dev
Hi Andrew and Michal,
On 10/06/2010 10:51 PM, Mike Frysinger wrote:
> On Wed, Oct 6, 2010 at 03:13, Thomas Chou wrote:
>> When we extracted the generated cpio archive using "cpio -id" command,
>> it complained,
>>
>> cpio: Removing leading `/' from member names
>> var/run
>> cpio: Removing leading `/' from member names
>> var/lib
>> cpio: Removing leading `/' from member names
>> var/lib/misc
>>
>> It is worse with the latest "cpio" or "pax", which tries to overwrite
>> the host file system with the leading '/'.
>
> seems to work as intended on Blackfin systems, and i cant see any
> reason to require the leading slash, so:
> Acked-by: Mike Frysinger<vapier@gentoo.org>
> -mike
>
>
Would you please review this patch? It is not clear as who should handle
this with the MAINTAINERS.
Best regards,
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gen_init_cpio: remove leading `/' from file names
2010-11-18 2:52 ` Thomas Chou
@ 2010-12-02 13:30 ` Michal Marek
0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2010-12-02 13:30 UTC (permalink / raw)
To: Thomas Chou; +Cc: Andrew Morton, Mike Frysinger, linux-kernel, nios2-dev
On Thu, Nov 18, 2010 at 10:52:51AM +0800, Thomas Chou wrote:
> Hi Andrew and Michal,
>
> On 10/06/2010 10:51 PM, Mike Frysinger wrote:
> >On Wed, Oct 6, 2010 at 03:13, Thomas Chou wrote:
> >>When we extracted the generated cpio archive using "cpio -id" command,
> >>it complained,
> >>
> >>cpio: Removing leading `/' from member names
> >>var/run
> >>cpio: Removing leading `/' from member names
> >>var/lib
> >>cpio: Removing leading `/' from member names
> >>var/lib/misc
> >>
> >>It is worse with the latest "cpio" or "pax", which tries to overwrite
> >>the host file system with the leading '/'.
> >
> >seems to work as intended on Blackfin systems, and i cant see any
> >reason to require the leading slash, so:
> >Acked-by: Mike Frysinger<vapier@gentoo.org>
> >-mike
> >
> >
>
> Would you please review this patch? It is not clear as who should
> handle this with the MAINTAINERS.
Applied to kbuild-2.6.git#kbuild, thanks a lot.
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-02 13:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 7:13 [PATCH] gen_init_cpio: remove leading `/' from file names Thomas Chou
2010-10-06 14:51 ` Mike Frysinger
2010-11-18 2:52 ` Thomas Chou
2010-12-02 13:30 ` Michal Marek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox