~alpine/devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[alpine-devel] [PATCH] apk-tools: archive: enable FIFO extraction

Jesse Young <jlyo@jlyo.org>
Details
Message ID
<20180813055752.GA6625@varda.jlyo.org>
Sender timestamp
1534139872
DKIM signature
missing
Download raw message
Patch: +5 -2
---
 src/archive.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/archive.c b/src/archive.c
index 9196cb2..1fc3e57 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -300,6 +300,9 @@ int apk_tar_parse(struct apk_istream *is, apk_archive_entry_parser parser,
		case '5': /* directory */
			entry.mode |= S_IFDIR;
			break;
		case '6': /* fifo */
			entry.mode |= S_IFIFO;
			break;
		case 'g': /* global pax header */
			break;
		case 'x': /* file specific pax header */
@@ -431,6 +434,7 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
	struct apk_xattr *xattr;
	char *fn = ae->name;
	int fd, r = -1, atflags = 0, ret = 0;
	mode_t nodmask = S_IFBLK | S_IFCHR | S_IFIFO | 07777;

	if (suffix != NULL) {
		fn = alloca(PATH_MAX);
@@ -477,11 +481,10 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
		if (r < 0) ret = -errno;
		atflags |= AT_SYMLINK_NOFOLLOW;
		break;
	case S_IFSOCK:
	case S_IFBLK:
	case S_IFCHR:
	case S_IFIFO:
		r = mknodat(atfd, fn, ae->mode & 07777, ae->device);
		r = mknodat(atfd, fn, ae->mode & nodmask, ae->device);
		if (r < 0) ret = -errno;
		break;
	}
-- 
2.18.0



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---

[alpine-devel] [PATCH v2] apk-tools: archive: enable FIFO extraction

Jesse Young <jlyo@jlyo.org>
Details
Message ID
<20180814173209.GA7887@varda.jlyo.org>
In-Reply-To
<20180814175117.250dc182@vostro> (view parent)
Sender timestamp
1534267929
DKIM signature
missing
Download raw message
Patch: +4 -2
---
 src/archive.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/archive.c b/src/archive.c
index 9196cb2..bc36ce7 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -300,6 +300,9 @@ int apk_tar_parse(struct apk_istream *is, apk_archive_entry_parser parser,
		case '5': /* directory */
			entry.mode |= S_IFDIR;
			break;
		case '6': /* fifo */
			entry.mode |= S_IFIFO;
			break;
		case 'g': /* global pax header */
			break;
		case 'x': /* file specific pax header */
@@ -477,11 +480,10 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
		if (r < 0) ret = -errno;
		atflags |= AT_SYMLINK_NOFOLLOW;
		break;
	case S_IFSOCK:
	case S_IFBLK:
	case S_IFCHR:
	case S_IFIFO:
		r = mknodat(atfd, fn, ae->mode & 07777, ae->device);
		r = mknodat(atfd, fn, ae->mode, ae->device);
		if (r < 0) ret = -errno;
		break;
	}
-- 
2.18.0



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Timo Teras <timo.teras@iki.fi>
Details
Message ID
<20180814175117.250dc182@vostro>
In-Reply-To
<20180813055752.GA6625@varda.jlyo.org> (view parent)
Sender timestamp
1534258277
DKIM signature
missing
Download raw message
Hi,

On Mon, 13 Aug 2018 00:57:52 -0500
Jesse Young <jlyo@jlyo.org> wrote:

>  src/archive.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
>[...]
>
> @@ -431,6 +434,7 @@ int apk_archive_entry_extract(int atfd, const
> struct apk_file_info *ae, struct apk_xattr *xattr;
>  	char *fn = ae->name;
>  	int fd, r = -1, atflags = 0, ret = 0;
> +	mode_t nodmask = S_IFBLK | S_IFCHR | S_IFIFO | 07777;
>  
>  	if (suffix != NULL) {
>  		fn = alloca(PATH_MAX);
> @@ -477,11 +481,10 @@ int apk_archive_entry_extract(int atfd, const
> struct apk_file_info *ae, if (r < 0) ret = -errno;
>  		atflags |= AT_SYMLINK_NOFOLLOW;
>  		break;
> -	case S_IFSOCK:
>  	case S_IFBLK:
>  	case S_IFCHR:
>  	case S_IFIFO:
> -		r = mknodat(atfd, fn, ae->mode & 07777, ae->device);
> +		r = mknodat(atfd, fn, ae->mode & nodmask,
> ae->device); if (r < 0) ret = -errno;
>  		break;
>  	}

The mode masking for mknodat() is an old bug. Let's just remove it. It
was added when the mask for other creation syscalls was changed from
0777 to 07777 to support setuid/setgid, but mknodat() really needs the
whole thing to create right type node.

Can you resubmit, or would you like me to amend your patch?

Thanks!

Timo


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---

[alpine-devel] Re: [PATCH v2] apk-tools: archive: enable FIFO extraction

Timo Teras <timo.teras@iki.fi>
Details
Message ID
<20180814232757.01c293bf@vostro>
In-Reply-To
<20180814173209.GA7887@varda.jlyo.org> (view parent)
Sender timestamp
1534278477
DKIM signature
missing
Download raw message
On Tue, 14 Aug 2018 12:32:09 -0500
Jesse Young <jlyo@jlyo.org> wrote:

> ---
>  src/archive.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Applied. Thanks.


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)