mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [RFC] Colons in filenames
Date: Wed, 10 Feb 2016 18:23:47 +0100	[thread overview]
Message-ID: <20160210172347.GA14137@pengutronix.de> (raw)
In-Reply-To: <20160203220502.GA10125@localhost.localdomain>

On Wed, Feb 03, 2016 at 11:05:02PM +0100, Ladislav Michl wrote:
> On Fri, Jan 22, 2016 at 09:06:36AM +0100, Michael Olbrich wrote:
> > On Fri, Jan 22, 2016 at 01:31:37AM +0100, Ladislav Michl wrote:
> > > Now I'm going to be honest. Previous patch 'Add usb-modeswitch-data package'
> > > break things - 'ptxdist images' fails as ':' is used as delimiter in perms file.
> > > Patch bellow escapes semicolon on producer side, anyone cares about consumer?
> > 
> > This does not work well with IFS in bash and FS in awk. but I think we can
> > switch different character. Maybe a vertical tab?
> 
> Well, I did not give up 'escaping idea' yet. What about something like this?
> (awk part could be done better)

I think the most readable would be replace the escaping:

'\:' -> 0x1
':'  -> 0x2
0x1  -> ':'

and then use 0x2 as separator.

Well there is also DOPERMISSIONS in rules/post/ptxd_make_image_common.make
which ist mostly but not exactly the same. But I suppose we could merge
that. It will require some testing and careful review. This stuff is rather
tricky.
And then there is scripts/lib/ptxd_make_image_fix_permissions.sh...

Michael

> diff --git a/scripts/lib/ptxd_lib_dopermissions.awk b/scripts/lib/ptxd_lib_dopermissions.awk
> index 336948c..17ee1b6 100755
> --- a/scripts/lib/ptxd_lib_dopermissions.awk
> +++ b/scripts/lib/ptxd_lib_dopermissions.awk
> @@ -5,13 +5,29 @@ BEGIN {
>  }
>  
>  $1 ~ "f" {
> -	printf("chmod %s	'.%s' &&\n" \
> -	       "chown %s.%s	'.%s' &&\n", \
> -	       $5, $2, $3, $4, $2);
> +	path = $2;
> +	for (i = 3; i <= NF; i++) {
> +		if (substr(path, length(path), 1) == "\\")
> +			path = substr(path, 1, length(path) - 1) ":" $i;
> +		else {
> +			printf("chmod %s	'.%s' &&\n" \
> +			       "chown %s.%s	'.%s' &&\n", \
> +			       $(i+2), path, $i, $(i+1), path);
> +			break;
> +		}
> +	}
>  }
>  
>  $1 ~ "n" {
> -	printf("mknod -m %s	'.%s'	%s %s %s &&\n" \
> -	       "chown %s.%s	'.%s' &&\n", \
> -	       $5, $2, $6, $7, $8, $3, $4, $2);
> +	path = $2;
> +	for (i = 3; i <= NF; i++) {
> +		if (substr(path, length(path), 1) == "\\")
> +			path = substr(path, 1, length(path) - 1) ":" $i;
> +		else {
> +			printf("mknod -m %s	'.%s'	%s %s %s &&\n" \
> +			       "chown %s.%s	'.%s' &&\n", \
> +			       $(i+2), path, $(i+3), $(i+4), $(i+5), $i, $(i+1), path);
> +			break;
> +		}
> +	}
>  }
> diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
> index 5ba404e..01ce361 100644
> --- a/scripts/lib/ptxd_make_xpkg_pkg.sh
> +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
> @@ -210,7 +210,7 @@ install directory:
>      install -m "${mod_nfs}" -d "${ndirs[@]/%/${dir}}" &&
>      install -m "${mod}" -o "${usr}" -g "${grp}" -d "${pdirs[@]/%/${dir}}" &&
>  
> -    echo "f:${dir}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}" ||
> +    echo "f:${dir//:/\\:}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}" ||
>      ptxd_install_error "install_dir failed!"
>  }
>  export -f ptxd_install_dir
> @@ -343,7 +343,7 @@ Usually, just remove the 6th parameter and everything works fine.
>      # now change to requested user and group
>      chown "${usr}:${grp}" "${pdirs[@]/%/${dst}}" &&
>  
> -    echo "f:${dst}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}"
> +    echo "f:${dst//:/\\:}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}"
>  }
>  export -f ptxd_install_file_impl
>  
> @@ -414,7 +414,7 @@ install device node:
>      done &&
>      chown "${usr}:${grp}" "${pdirs[@]/%/${dst}}" &&
>  
> -    echo "n:${dst}:${usr}:${grp}:${mod}:${type}:${major}:${minor}" >> "${pkg_xpkg_perms}"
> +    echo "n:${dst//:/\\:}:${usr}:${grp}:${mod}:${type}:${major}:${minor}" >> "${pkg_xpkg_perms}"
>  }
>  export -f ptxd_install_mknod
>  
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2016-02-10 17:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22  0:31 [ptxdist] Semicolon " Ladislav Michl
2016-01-22  7:18 ` Uwe Kleine-König
2016-01-22  8:10   ` [ptxdist] Colons " Ladislav Michl
2016-01-22  8:06 ` [ptxdist] Semicolon " Michael Olbrich
2016-02-03 22:05   ` [ptxdist] [RFC] Colons " Ladislav Michl
2016-02-10 17:23     ` Michael Olbrich [this message]
2016-07-13 10:24       ` Ladislav Michl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160210172347.GA14137@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox