* [PATCH v2 0/4] Fixes for makedevs
@ 2013-05-30 7:19 Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 1/4] makedevs: Create blocks of devices with the correct uid/gid Peter Kjellerstedt
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 7:19 UTC (permalink / raw)
To: openembedded-core
When I wanted to create devices from a package I stumbled upon a couple
of problems with the makedevs program. Most notable was that it failed
to set the correct uid/gid for devices created as part of a block (i.e.,
with a count > 0).
And now with Signed-off-by lines, as requested.
The following changes since commit efb8a460d2a977dbd481a0650fba8eb637c65bec:
package.bbclass: Fix sources contents (2013-05-14 08:52:47 +0300)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib pkj/makedevs
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/makedevs
Peter Kjellerstedt (4):
makedevs: Create blocks of devices with the correct uid/gid
makedevs: Correct the device number calculation for blocks of devices
makedevs: Make the mode number readable in debug messages
makedevs: Avoid unnecessary timestamp calculation
.../recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
--
1.8.2.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/4] makedevs: Create blocks of devices with the correct uid/gid
2013-05-30 7:19 [PATCH v2 0/4] Fixes for makedevs Peter Kjellerstedt
@ 2013-05-30 7:19 ` Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 2/4] makedevs: Correct the device number calculation for blocks of devices Peter Kjellerstedt
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 7:19 UTC (permalink / raw)
To: openembedded-core
When creating a block of devices (i.e., when count > 0), the wrong
path was used with the call to chown(), effectively trying to change
the owner of some (probably) non-existent file. Thus the created
device nodes were always owned by root.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index c7ad722..247d6c1 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -130,7 +130,7 @@ static void add_new_device(char *name, char *path, unsigned long uid,
timestamp = sb.st_mtime;
}
- mknod(name, mode, rdev);
+ mknod(path, mode, rdev);
chown(path, uid, gid);
// printf("Device: %s %s UID: %ld GID: %ld MODE: %ld MAJOR: %d MINOR: %d\n",
// path, name, uid, gid, mode, (short)(rdev >> 8), (short)(rdev & 0xff));
@@ -198,7 +198,7 @@ static int interpret_table_entry(char *line)
error_msg_and_die("Device table entries require absolute paths");
}
name = xstrdup(path + 1);
- sprintf(path, "%s/%s\0", rootdir, name);
+ sprintf(path, "%s/%s", rootdir, name);
switch (type) {
case 'd':
@@ -223,6 +223,7 @@ static int interpret_table_entry(char *line)
for (i = start; i < count; i++) {
sprintf(buf, "%s%d", name, i);
+ sprintf(path, "%s/%s%d", rootdir, name, i);
/* FIXME: MKDEV uses illicit insider knowledge of kernel
* major/minor representation... */
rdev = MKDEV(major, minor + (i * increment - start));
--
1.8.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/4] makedevs: Correct the device number calculation for blocks of devices
2013-05-30 7:19 [PATCH v2 0/4] Fixes for makedevs Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 1/4] makedevs: Create blocks of devices with the correct uid/gid Peter Kjellerstedt
@ 2013-05-30 7:19 ` Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 3/4] makedevs: Make the mode number readable in debug messages Peter Kjellerstedt
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 7:19 UTC (permalink / raw)
To: openembedded-core
If the increment > 1 and the start > 0 then the calculation for the
minor device number was incorrect.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index 247d6c1..d58e891 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -226,7 +226,7 @@ static int interpret_table_entry(char *line)
sprintf(path, "%s/%s%d", rootdir, name, i);
/* FIXME: MKDEV uses illicit insider knowledge of kernel
* major/minor representation... */
- rdev = MKDEV(major, minor + (i * increment - start));
+ rdev = MKDEV(major, minor + (i - start) * increment);
add_new_device(buf, path, uid, gid, mode, rdev);
}
} else {
--
1.8.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/4] makedevs: Make the mode number readable in debug messages
2013-05-30 7:19 [PATCH v2 0/4] Fixes for makedevs Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 1/4] makedevs: Create blocks of devices with the correct uid/gid Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 2/4] makedevs: Correct the device number calculation for blocks of devices Peter Kjellerstedt
@ 2013-05-30 7:19 ` Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 4/4] makedevs: Avoid unnecessary timestamp calculation Peter Kjellerstedt
2013-05-30 9:02 ` [PATCH v2 0/4] Fixes for makedevs Bernhard Reutner-Fischer
4 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 7:19 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index d58e891..4cfb1d5 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -108,7 +108,7 @@ static void add_new_directory(char *name, char *path,
{
mkdir(path, mode);
chown(path, uid, gid);
-// printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode);
+// printf("Directory: %s %s UID: %ld GID %ld MODE: %04lo\n", path, name, uid, gid, mode);
}
static void add_new_device(char *name, char *path, unsigned long uid,
@@ -132,7 +132,7 @@ static void add_new_device(char *name, char *path, unsigned long uid,
mknod(path, mode, rdev);
chown(path, uid, gid);
-// printf("Device: %s %s UID: %ld GID: %ld MODE: %ld MAJOR: %d MINOR: %d\n",
+// printf("Device: %s %s UID: %ld GID: %ld MODE: %04lo MAJOR: %d MINOR: %d\n",
// path, name, uid, gid, mode, (short)(rdev >> 8), (short)(rdev & 0xff));
}
@@ -147,7 +147,7 @@ static void add_new_file(char *name, char *path, unsigned long uid,
}
chmod(path, mode);
chown(path, uid, gid);
-// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n",
+// printf("File: %s %s UID: %ld GID: %ld MODE: %04lo\n",
// path, name, gid, uid, mode);
}
@@ -158,7 +158,7 @@ static void add_new_fifo(char *name, char *path, unsigned long uid,
if (mknod(path, mode, 0))
error_msg_and_die("%s: file can not be created with mknod!", path);
chown(path, uid, gid);
-// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n",
+// printf("File: %s %s UID: %ld GID: %ld MODE: %04lo\n",
// path, name, gid, uid, mode);
}
--
1.8.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/4] makedevs: Avoid unnecessary timestamp calculation
2013-05-30 7:19 [PATCH v2 0/4] Fixes for makedevs Peter Kjellerstedt
` (2 preceding siblings ...)
2013-05-30 7:19 ` [PATCH v2 3/4] makedevs: Make the mode number readable in debug messages Peter Kjellerstedt
@ 2013-05-30 7:19 ` Peter Kjellerstedt
2013-05-30 9:02 ` [PATCH v2 0/4] Fixes for makedevs Bernhard Reutner-Fischer
4 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 7:19 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index 4cfb1d5..4bb316b 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -116,7 +116,6 @@ static void add_new_device(char *name, char *path, unsigned long uid,
{
int status;
struct stat sb;
- time_t timestamp = time(NULL);
memset(&sb, 0, sizeof(struct stat));
status = lstat(path, &sb);
@@ -127,7 +126,6 @@ static void add_new_device(char *name, char *path, unsigned long uid,
* better match the actual file or strange things will happen.... */
if ((mode & S_IFMT) != (sb.st_mode & S_IFMT))
error_msg_and_die("%s: file type does not match specified type!", path);
- timestamp = sb.st_mtime;
}
mknod(path, mode, rdev);
--
1.8.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/4] Fixes for makedevs
2013-05-30 7:19 [PATCH v2 0/4] Fixes for makedevs Peter Kjellerstedt
` (3 preceding siblings ...)
2013-05-30 7:19 ` [PATCH v2 4/4] makedevs: Avoid unnecessary timestamp calculation Peter Kjellerstedt
@ 2013-05-30 9:02 ` Bernhard Reutner-Fischer
2013-05-30 12:14 ` Peter Kjellerstedt
4 siblings, 1 reply; 7+ messages in thread
From: Bernhard Reutner-Fischer @ 2013-05-30 9:02 UTC (permalink / raw)
To: Peter Kjellerstedt, openembedded-core
On 30 May 2013 09:19:54 Peter Kjellerstedt <peter.kjellerstedt@axis.com> wrote:
> When I wanted to create devices from a package I stumbled upon a couple
> of problems with the makedevs program. Most notable was that it failed
> to set the correct uid/gid for devices created as part of a block (i.e.,
> with a count > 0).
>
> And now with Signed-off-by lines, as requested.
Are these appropriate for or fixed already in upstream, I.e. Busybox?
Thanks,
>
> The following changes since commit efb8a460d2a977dbd481a0650fba8eb637c65bec:
>
> package.bbclass: Fix sources contents (2013-05-14 08:52:47 +0300)
>
> are available in the git repository at:
>
> git://git.yoctoproject.org/poky-contrib pkj/makedevs
> http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/makedevs
>
> Peter Kjellerstedt (4):
> makedevs: Create blocks of devices with the correct uid/gid
> makedevs: Correct the device number calculation for blocks of devices
> makedevs: Make the mode number readable in debug messages
> makedevs: Avoid unnecessary timestamp calculation
>
> .../recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> --
> 1.8.2.1
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Sent with AquaMail for Android
http://www.aqua-mail.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/4] Fixes for makedevs
2013-05-30 9:02 ` [PATCH v2 0/4] Fixes for makedevs Bernhard Reutner-Fischer
@ 2013-05-30 12:14 ` Peter Kjellerstedt
0 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 12:14 UTC (permalink / raw)
To: Bernhard Reutner-Fischer,
openembedded-core@lists.openembedded.org
> -----Original Message-----
> From: Bernhard Reutner-Fischer [mailto:rep.dot.nop@gmail.com]
> Sent: den 30 maj 2013 11:02
> To: Peter Kjellerstedt; openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH v2 0/4] Fixes for makedevs
>
> On 30 May 2013 09:19:54 Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> wrote:
> > When I wanted to create devices from a package I stumbled upon a
> couple
> > of problems with the makedevs program. Most notable was that it
> failed
> > to set the correct uid/gid for devices created as part of a block
> (i.e.,
> > with a count > 0).
> >
> > And now with Signed-off-by lines, as requested.
>
> Are these appropriate for or fixed already in upstream, I.e. Busybox?
I took a look at makdevs.c in BusyBox, and as far as I can tell
that version already has the relevant fixes.
It also made me notice another mistake in the current OE version
(it loops from start to count-1 rather than start to start+count-1)...
I will send an updated version of the patch series that fixes this.
//Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-05-30 12:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 7:19 [PATCH v2 0/4] Fixes for makedevs Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 1/4] makedevs: Create blocks of devices with the correct uid/gid Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 2/4] makedevs: Correct the device number calculation for blocks of devices Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 3/4] makedevs: Make the mode number readable in debug messages Peter Kjellerstedt
2013-05-30 7:19 ` [PATCH v2 4/4] makedevs: Avoid unnecessary timestamp calculation Peter Kjellerstedt
2013-05-30 9:02 ` [PATCH v2 0/4] Fixes for makedevs Bernhard Reutner-Fischer
2013-05-30 12:14 ` Peter Kjellerstedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.