mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] use ^_ as separator in perms files
@ 2016-07-18 11:22 Ladislav Michl
  2016-07-27 10:59 ` Michael Olbrich
  0 siblings, 1 reply; 10+ messages in thread
From: Ladislav Michl @ 2016-07-18 11:22 UTC (permalink / raw)
  To: ptxdist

Change separator to allow ':' in filenames.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 rules/post/image_cpio.make                     | 2 +-
 rules/post/image_ext2.make                     | 2 +-
 rules/post/image_jffs2.make                    | 2 +-
 rules/post/image_squashfs.make                 | 2 +-
 rules/post/image_tgz.make                      | 6 +++---
 rules/post/image_ubi.make                      | 2 +-
 rules/post/ptxd_make_image_common.make         | 2 +-
 scripts/lib/ptxd_lib_dopermissions.awk         | 2 +-
 scripts/lib/ptxd_make_image_fix_permissions.sh | 4 ++--
 scripts/lib/ptxd_make_xpkg_pkg.sh              | 9 ++++++---
 10 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/rules/post/image_cpio.make b/rules/post/image_cpio.make
index 573faee..200b283 100644
--- a/rules/post/image_cpio.make
+++ b/rules/post/image_cpio.make
@@ -15,7 +15,7 @@ $(IMAGEDIR)/root.cpio: $(STATEDIR)/image_working_dir
 	@echo -n "Creating '$(notdir $(@))' from working dir..."
 	@cd $(image/work_dir) && \
 	( \
-		awk -F: $(DOPERMISSIONS) $(image/permissions) && \
+		awk $(DOPERMISSIONS) $(image/permissions) && \
 		echo "find . | cpio --quiet -H newc -o > '$(@)'" \
 	) | $(FAKEROOT) --
 	@echo "done."
diff --git a/rules/post/image_ext2.make b/rules/post/image_ext2.make
index 3e3423b..0dbcafd 100644
--- a/rules/post/image_ext2.make
+++ b/rules/post/image_ext2.make
@@ -15,7 +15,7 @@ ifdef PTXCONF_IMAGE_EXT2
 $(IMAGEDIR)/root.ext2: $(STATEDIR)/image_working_dir
 	@echo -n "Creating root.ext2 from working dir..."
 	@cd $(image/work_dir);						\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
 	(								\
 		echo -n "$(PTXCONF_SYSROOT_HOST)/bin/genext2fs ";	\
 		echo -n "-b $(PTXCONF_IMAGE_EXT2_SIZE) ";		\
diff --git a/rules/post/image_jffs2.make b/rules/post/image_jffs2.make
index 5e448f5..7f12883 100644
--- a/rules/post/image_jffs2.make
+++ b/rules/post/image_jffs2.make
@@ -17,7 +17,7 @@ $(IMAGEDIR)/root.jffs2: $(STATEDIR)/image_working_dir $(STATEDIR)/host-mtd-utils
 	@echo -n "(--eraseblock=$(PTXCONF_IMAGE_JFFS2_BLOCKSIZE) "
 	@echo "$(call remove_quotes,$(PTXCONF_IMAGE_JFFS2_EXTRA_ARGS)))"
 	@cd $(image/work_dir);						\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
 	(								\
 		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mkfs.jffs2 ";	\
 		echo -n "-d $(image/work_dir) ";			\
diff --git a/rules/post/image_squashfs.make b/rules/post/image_squashfs.make
index 6d02255..69dc721 100644
--- a/rules/post/image_squashfs.make
+++ b/rules/post/image_squashfs.make
@@ -19,7 +19,7 @@ ifdef PTXCONF_IMAGE_SQUASHFS
 $(IMAGEDIR)/root.squashfs: $(STATEDIR)/image_working_dir $(STATEDIR)/host-squashfs-tools.install.post
 	@echo -n "Creating root.squashfs from working dir..."
 	@cd $(image/work_dir);							\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
 	(								\
 		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mksquashfs ";	\
 		echo -n "$(image/work_dir) ";					\
diff --git a/rules/post/image_tgz.make b/rules/post/image_tgz.make
index 57f69f4..bace4da 100644
--- a/rules/post/image_tgz.make
+++ b/rules/post/image_tgz.make
@@ -18,10 +18,10 @@ endif
 
 $(IMAGEDIR)/root.tgz: $(STATEDIR)/image_working_dir
 	@echo -n 'Creating root.tgz from working dir$(if $(IMAGE_TGZ_LABEL), with label "$(IMAGE_TGZ_LABEL)",)... '
-	@cd $(image/work_dir);							\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
+	@cd $(image/work_dir);					\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&		\
 	(	echo -n "tar ${IMAGE_TGZ_LABEL_ARGS} -zcf ";	\
-		echo -n "$@ ." )					\
+		echo -n "$@ ." )				\
 	) | $(FAKEROOT) --
 	@echo "done."
 endif
diff --git a/rules/post/image_ubi.make b/rules/post/image_ubi.make
index edfae1d..17321dc 100644
--- a/rules/post/image_ubi.make
+++ b/rules/post/image_ubi.make
@@ -22,7 +22,7 @@ $(IMAGEDIR)/root.ubifs: $(STATEDIR)/image_working_dir $(STATEDIR)/host-mtd-utils
 	@echo -n "-e $(PTXCONF_IMAGE_UBIFS_LEB_SIZE) -c $(PTXCONF_IMAGE_UBIFS_ROOT_MAX_LEB_COUNT) "
 	@echo -n "$(PTXCONF_IMAGE_UBIFS_EXTRA_ARGS))"
 	@cd $(image/work_dir);								\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&			\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&				\
 	(									\
 		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mkfs.ubifs ";		\
 		echo -n "-d $(image/work_dir) ";					\
diff --git a/rules/post/ptxd_make_image_common.make b/rules/post/ptxd_make_image_common.make
index 7ccb501..0f274bf 100644
--- a/rules/post/ptxd_make_image_common.make
+++ b/rules/post/ptxd_make_image_common.make
@@ -8,7 +8,7 @@
 # see the README file.
 #
 
-DOPERMISSIONS := '{	\
+DOPERMISSIONS := '{ FS = "\x1F";	\
 	if ($$1 == "f")	\
 		printf("chmod %s \".%s\"; chown %s.%s \".%s\";\n", $$5, $$2, $$3, $$4, $$2);	\
 	if ($$1 == "n")	\
diff --git a/scripts/lib/ptxd_lib_dopermissions.awk b/scripts/lib/ptxd_lib_dopermissions.awk
index 336948c..3596121 100755
--- a/scripts/lib/ptxd_lib_dopermissions.awk
+++ b/scripts/lib/ptxd_lib_dopermissions.awk
@@ -1,7 +1,7 @@
 #!/usr/bin/awk -f
 
 BEGIN {
-	FS = ":";
+	FS = "\x1F";
 }
 
 $1 ~ "f" {
diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh
index eae2ab3..bc4b4b9 100644
--- a/scripts/lib/ptxd_make_image_fix_permissions.sh
+++ b/scripts/lib/ptxd_make_image_fix_permissions.sh
@@ -32,10 +32,10 @@ export -f ptxd_make_image_fix_permissions_generate
 ptxd_make_image_fix_permissions_check() {
     local workdir="${1}"
     local ifs_orig="${IFS}"
-    IFS=":"
+    IFS="\x1F"
 
     # just care about dev-nodes, for now
-    egrep -h "^[n]:" "${ptxd_reply_perm_files[@]}" |
+    egrep -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
     while read kind file uid_should gid_should prm_should type major_should minor_should; do
 	local fixup=false
 	file="${workdir}/${file#/}"
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index ba9094b..b1de2fd 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -191,6 +191,7 @@ ptxd_install_setup_src() {
 export -f ptxd_install_setup_src
 
 ptxd_install_dir() {
+    local sep="\x1F"
     local dir="$1"
     local usr="$2"
     local grp="$3"
@@ -210,7 +211,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 -e "f${sep}${dir}${sep}${usr}${sep}${grp}${sep}${mod}" >> "${pkg_xpkg_perms}" ||
     ptxd_install_error "install_dir failed!"
 }
 export -f ptxd_install_dir
@@ -285,6 +286,7 @@ export -f ptxd_install_file_strip
 
 
 ptxd_install_file_impl() {
+    local sep="\x1F"
     local src="$1"
     local dst="$2"
     local usr="$3"
@@ -350,7 +352,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 -e "f${sep}${dst}${sep}${usr}${sep}${grp}${sep}${mod}" >> "${pkg_xpkg_perms}"
 }
 export -f ptxd_install_file_impl
 
@@ -392,6 +394,7 @@ install link:
 export -f ptxd_install_ln
 
 ptxd_install_mknod() {
+    local sep="\x1F"
     local dst="$1"
     local usr="$2"
     local grp="$3"
@@ -421,7 +424,7 @@ install device node:
     done &&
     chown "${usr}:${grp}" "${pdirs[@]/%/${dst}}" &&
 
-    echo "n:${dst}:${usr}:${grp}:${mod}:${type}:${major}:${minor}" >> "${pkg_xpkg_perms}"
+    echo -e "n${sep}${dst}${sep}${usr}${sep}${grp}${sep}${mod}${sep}${type}${sep}${major}${sep}${minor}" >> "${pkg_xpkg_perms}"
 }
 export -f ptxd_install_mknod
 
-- 
2.1.4


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH] use ^_ as separator in perms files
  2016-07-18 11:22 [ptxdist] [PATCH] use ^_ as separator in perms files Ladislav Michl
@ 2016-07-27 10:59 ` Michael Olbrich
  2016-07-28 23:12   ` Ladislav Michl
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Olbrich @ 2016-07-27 10:59 UTC (permalink / raw)
  To: ptxdist

On Mon, Jul 18, 2016 at 01:22:17PM +0200, Ladislav Michl wrote:
> Change separator to allow ':' in filenames.

I like it in general. But I think we should explicitly error out if we come
across an old command file (NF == 1). And tell the user to run "ptxdist
clean root" or something like that.

Michael

> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>  rules/post/image_cpio.make                     | 2 +-
>  rules/post/image_ext2.make                     | 2 +-
>  rules/post/image_jffs2.make                    | 2 +-
>  rules/post/image_squashfs.make                 | 2 +-
>  rules/post/image_tgz.make                      | 6 +++---
>  rules/post/image_ubi.make                      | 2 +-
>  rules/post/ptxd_make_image_common.make         | 2 +-
>  scripts/lib/ptxd_lib_dopermissions.awk         | 2 +-
>  scripts/lib/ptxd_make_image_fix_permissions.sh | 4 ++--
>  scripts/lib/ptxd_make_xpkg_pkg.sh              | 9 ++++++---
>  10 files changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/rules/post/image_cpio.make b/rules/post/image_cpio.make
> index 573faee..200b283 100644
> --- a/rules/post/image_cpio.make
> +++ b/rules/post/image_cpio.make
> @@ -15,7 +15,7 @@ $(IMAGEDIR)/root.cpio: $(STATEDIR)/image_working_dir
>  	@echo -n "Creating '$(notdir $(@))' from working dir..."
>  	@cd $(image/work_dir) && \
>  	( \
> -		awk -F: $(DOPERMISSIONS) $(image/permissions) && \
> +		awk $(DOPERMISSIONS) $(image/permissions) && \
>  		echo "find . | cpio --quiet -H newc -o > '$(@)'" \
>  	) | $(FAKEROOT) --
>  	@echo "done."
> diff --git a/rules/post/image_ext2.make b/rules/post/image_ext2.make
> index 3e3423b..0dbcafd 100644
> --- a/rules/post/image_ext2.make
> +++ b/rules/post/image_ext2.make
> @@ -15,7 +15,7 @@ ifdef PTXCONF_IMAGE_EXT2
>  $(IMAGEDIR)/root.ext2: $(STATEDIR)/image_working_dir
>  	@echo -n "Creating root.ext2 from working dir..."
>  	@cd $(image/work_dir);						\
> -	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
> +	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
>  	(								\
>  		echo -n "$(PTXCONF_SYSROOT_HOST)/bin/genext2fs ";	\
>  		echo -n "-b $(PTXCONF_IMAGE_EXT2_SIZE) ";		\
> diff --git a/rules/post/image_jffs2.make b/rules/post/image_jffs2.make
> index 5e448f5..7f12883 100644
> --- a/rules/post/image_jffs2.make
> +++ b/rules/post/image_jffs2.make
> @@ -17,7 +17,7 @@ $(IMAGEDIR)/root.jffs2: $(STATEDIR)/image_working_dir $(STATEDIR)/host-mtd-utils
>  	@echo -n "(--eraseblock=$(PTXCONF_IMAGE_JFFS2_BLOCKSIZE) "
>  	@echo "$(call remove_quotes,$(PTXCONF_IMAGE_JFFS2_EXTRA_ARGS)))"
>  	@cd $(image/work_dir);						\
> -	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
> +	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
>  	(								\
>  		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mkfs.jffs2 ";	\
>  		echo -n "-d $(image/work_dir) ";			\
> diff --git a/rules/post/image_squashfs.make b/rules/post/image_squashfs.make
> index 6d02255..69dc721 100644
> --- a/rules/post/image_squashfs.make
> +++ b/rules/post/image_squashfs.make
> @@ -19,7 +19,7 @@ ifdef PTXCONF_IMAGE_SQUASHFS
>  $(IMAGEDIR)/root.squashfs: $(STATEDIR)/image_working_dir $(STATEDIR)/host-squashfs-tools.install.post
>  	@echo -n "Creating root.squashfs from working dir..."
>  	@cd $(image/work_dir);							\
> -	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
> +	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
>  	(								\
>  		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mksquashfs ";	\
>  		echo -n "$(image/work_dir) ";					\
> diff --git a/rules/post/image_tgz.make b/rules/post/image_tgz.make
> index 57f69f4..bace4da 100644
> --- a/rules/post/image_tgz.make
> +++ b/rules/post/image_tgz.make
> @@ -18,10 +18,10 @@ endif
>  
>  $(IMAGEDIR)/root.tgz: $(STATEDIR)/image_working_dir
>  	@echo -n 'Creating root.tgz from working dir$(if $(IMAGE_TGZ_LABEL), with label "$(IMAGE_TGZ_LABEL)",)... '
> -	@cd $(image/work_dir);							\
> -	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
> +	@cd $(image/work_dir);					\
> +	(awk $(DOPERMISSIONS) $(image/permissions) &&		\
>  	(	echo -n "tar ${IMAGE_TGZ_LABEL_ARGS} -zcf ";	\
> -		echo -n "$@ ." )					\
> +		echo -n "$@ ." )				\
>  	) | $(FAKEROOT) --
>  	@echo "done."
>  endif
> diff --git a/rules/post/image_ubi.make b/rules/post/image_ubi.make
> index edfae1d..17321dc 100644
> --- a/rules/post/image_ubi.make
> +++ b/rules/post/image_ubi.make
> @@ -22,7 +22,7 @@ $(IMAGEDIR)/root.ubifs: $(STATEDIR)/image_working_dir $(STATEDIR)/host-mtd-utils
>  	@echo -n "-e $(PTXCONF_IMAGE_UBIFS_LEB_SIZE) -c $(PTXCONF_IMAGE_UBIFS_ROOT_MAX_LEB_COUNT) "
>  	@echo -n "$(PTXCONF_IMAGE_UBIFS_EXTRA_ARGS))"
>  	@cd $(image/work_dir);								\
> -	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&			\
> +	(awk $(DOPERMISSIONS) $(image/permissions) &&				\
>  	(									\
>  		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mkfs.ubifs ";		\
>  		echo -n "-d $(image/work_dir) ";					\
> diff --git a/rules/post/ptxd_make_image_common.make b/rules/post/ptxd_make_image_common.make
> index 7ccb501..0f274bf 100644
> --- a/rules/post/ptxd_make_image_common.make
> +++ b/rules/post/ptxd_make_image_common.make
> @@ -8,7 +8,7 @@
>  # see the README file.
>  #
>  
> -DOPERMISSIONS := '{	\
> +DOPERMISSIONS := '{ FS = "\x1F";	\
>  	if ($$1 == "f")	\
>  		printf("chmod %s \".%s\"; chown %s.%s \".%s\";\n", $$5, $$2, $$3, $$4, $$2);	\
>  	if ($$1 == "n")	\
> diff --git a/scripts/lib/ptxd_lib_dopermissions.awk b/scripts/lib/ptxd_lib_dopermissions.awk
> index 336948c..3596121 100755
> --- a/scripts/lib/ptxd_lib_dopermissions.awk
> +++ b/scripts/lib/ptxd_lib_dopermissions.awk
> @@ -1,7 +1,7 @@
>  #!/usr/bin/awk -f
>  
>  BEGIN {
> -	FS = ":";
> +	FS = "\x1F";
>  }
>  
>  $1 ~ "f" {
> diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh
> index eae2ab3..bc4b4b9 100644
> --- a/scripts/lib/ptxd_make_image_fix_permissions.sh
> +++ b/scripts/lib/ptxd_make_image_fix_permissions.sh
> @@ -32,10 +32,10 @@ export -f ptxd_make_image_fix_permissions_generate
>  ptxd_make_image_fix_permissions_check() {
>      local workdir="${1}"
>      local ifs_orig="${IFS}"
> -    IFS=":"
> +    IFS="\x1F"
>  
>      # just care about dev-nodes, for now
> -    egrep -h "^[n]:" "${ptxd_reply_perm_files[@]}" |
> +    egrep -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
>      while read kind file uid_should gid_should prm_should type major_should minor_should; do
>  	local fixup=false
>  	file="${workdir}/${file#/}"
> diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
> index ba9094b..b1de2fd 100644
> --- a/scripts/lib/ptxd_make_xpkg_pkg.sh
> +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
> @@ -191,6 +191,7 @@ ptxd_install_setup_src() {
>  export -f ptxd_install_setup_src
>  
>  ptxd_install_dir() {
> +    local sep="\x1F"
>      local dir="$1"
>      local usr="$2"
>      local grp="$3"
> @@ -210,7 +211,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 -e "f${sep}${dir}${sep}${usr}${sep}${grp}${sep}${mod}" >> "${pkg_xpkg_perms}" ||
>      ptxd_install_error "install_dir failed!"
>  }
>  export -f ptxd_install_dir
> @@ -285,6 +286,7 @@ export -f ptxd_install_file_strip
>  
>  
>  ptxd_install_file_impl() {
> +    local sep="\x1F"
>      local src="$1"
>      local dst="$2"
>      local usr="$3"
> @@ -350,7 +352,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 -e "f${sep}${dst}${sep}${usr}${sep}${grp}${sep}${mod}" >> "${pkg_xpkg_perms}"
>  }
>  export -f ptxd_install_file_impl
>  
> @@ -392,6 +394,7 @@ install link:
>  export -f ptxd_install_ln
>  
>  ptxd_install_mknod() {
> +    local sep="\x1F"
>      local dst="$1"
>      local usr="$2"
>      local grp="$3"
> @@ -421,7 +424,7 @@ install device node:
>      done &&
>      chown "${usr}:${grp}" "${pdirs[@]/%/${dst}}" &&
>  
> -    echo "n:${dst}:${usr}:${grp}:${mod}:${type}:${major}:${minor}" >> "${pkg_xpkg_perms}"
> +    echo -e "n${sep}${dst}${sep}${usr}${sep}${grp}${sep}${mod}${sep}${type}${sep}${major}${sep}${minor}" >> "${pkg_xpkg_perms}"
>  }
>  export -f ptxd_install_mknod
>  
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH] use ^_ as separator in perms files
  2016-07-27 10:59 ` Michael Olbrich
@ 2016-07-28 23:12   ` Ladislav Michl
  2016-07-29  7:39     ` Michael Olbrich
  0 siblings, 1 reply; 10+ messages in thread
From: Ladislav Michl @ 2016-07-28 23:12 UTC (permalink / raw)
  To: ptxdist

On Wed, Jul 27, 2016 at 12:59:39PM +0200, Michael Olbrich wrote:
> On Mon, Jul 18, 2016 at 01:22:17PM +0200, Ladislav Michl wrote:
> > Change separator to allow ':' in filenames.
> 
> I like it in general. But I think we should explicitly error out if we come
> across an old command file (NF == 1). And tell the user to run "ptxdist
> clean root" or something like that.
[snip]

Do you mean something like this (untested):

diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh
index c1cfdba..d4bf6b0 100644
--- a/scripts/lib/ptxd_make_image_fix_permissions.sh
+++ b/scripts/lib/ptxd_make_image_fix_permissions.sh
@@ -34,6 +34,11 @@ ptxd_make_image_fix_permissions_check() {
     local ifs_orig="${IFS}"
     IFS="\x1F"
 
+    # previous PTXdist versions used ":" as a separator
+    if ! grep -q "${IFS}" "${ptxd_reply_perm_files[@]}"; then
+       ptxd_bailout "obsolete perm file detected, please run 'ptxdist clean root'"
+    fi
+
     # just care about dev-nodes, for now
     egrep -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
     while read kind file uid_should gid_should prm_should type major_should minor_should; do

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH] use ^_ as separator in perms files
  2016-07-28 23:12   ` Ladislav Michl
@ 2016-07-29  7:39     ` Michael Olbrich
  2016-07-31 21:10       ` [ptxdist] [PATCH v2] " Ladislav Michl
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Olbrich @ 2016-07-29  7:39 UTC (permalink / raw)
  To: ptxdist

On Fri, Jul 29, 2016 at 01:12:04AM +0200, Ladislav Michl wrote:
> On Wed, Jul 27, 2016 at 12:59:39PM +0200, Michael Olbrich wrote:
> > On Mon, Jul 18, 2016 at 01:22:17PM +0200, Ladislav Michl wrote:
> > > Change separator to allow ':' in filenames.
> > 
> > I like it in general. But I think we should explicitly error out if we come
> > across an old command file (NF == 1). And tell the user to run "ptxdist
> > clean root" or something like that.
> [snip]
> 
> Do you mean something like this (untested):

I think it needs to be added to ptxd_dopermissions as well. I think the
stuff below is called first, but it's optional. Maybe some funtion:

ptxd_check_obsolete_perm() {
    if ! grep -q -P "\x1F" "${@}" ; then
	ptxd_bailout "obsolete perm file detected, please run 'ptxdist clean root'"
    fi
}

And call it from both. And note the '-P'. Otherwise the \x is not
interpreted.

Michael

> diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh
> index c1cfdba..d4bf6b0 100644
> --- a/scripts/lib/ptxd_make_image_fix_permissions.sh
> +++ b/scripts/lib/ptxd_make_image_fix_permissions.sh
> @@ -34,6 +34,11 @@ ptxd_make_image_fix_permissions_check() {
>      local ifs_orig="${IFS}"
>      IFS="\x1F"
>  
> +    # previous PTXdist versions used ":" as a separator
> +    if ! grep -q "${IFS}" "${ptxd_reply_perm_files[@]}"; then
> +       ptxd_bailout "obsolete perm file detected, please run 'ptxdist clean root'"
> +    fi
> +
>      # just care about dev-nodes, for now
>      egrep -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
>      while read kind file uid_should gid_should prm_should type major_should minor_should; do
> 
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ptxdist] [PATCH v2] use ^_ as separator in perms files
  2016-07-29  7:39     ` Michael Olbrich
@ 2016-07-31 21:10       ` Ladislav Michl
  2016-08-03 10:23         ` Ladislav Michl
  0 siblings, 1 reply; 10+ messages in thread
From: Ladislav Michl @ 2016-07-31 21:10 UTC (permalink / raw)
  To: ptxdist

Change separator to allow ':' in filenames.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 Changes since v1:
  - bail out when old perm file format is found
    (Note that if packets are pulled from ipkg repository, running
     'ptxdist clean root' will not help)

 rules/post/image_cpio.make                     |  2 +-
 rules/post/image_ext2.make                     |  2 +-
 rules/post/image_jffs2.make                    |  2 +-
 rules/post/image_squashfs.make                 |  2 +-
 rules/post/image_tgz.make                      |  6 +++---
 rules/post/image_ubi.make                      |  2 +-
 rules/post/ptxd_make_image_common.make         |  2 +-
 scripts/lib/ptxd_lib_dopermissions.awk         |  2 +-
 scripts/lib/ptxd_make_image_fix_permissions.sh |  6 ++++--
 scripts/lib/ptxd_make_xpkg_common.sh           |  1 +
 scripts/lib/ptxd_make_xpkg_pkg.sh              |  9 ++++++---
 scripts/libptxdist.sh                          | 11 +++++++++++
 12 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/rules/post/image_cpio.make b/rules/post/image_cpio.make
index 573faee..200b283 100644
--- a/rules/post/image_cpio.make
+++ b/rules/post/image_cpio.make
@@ -15,7 +15,7 @@ $(IMAGEDIR)/root.cpio: $(STATEDIR)/image_working_dir
 	@echo -n "Creating '$(notdir $(@))' from working dir..."
 	@cd $(image/work_dir) && \
 	( \
-		awk -F: $(DOPERMISSIONS) $(image/permissions) && \
+		awk $(DOPERMISSIONS) $(image/permissions) && \
 		echo "find . | cpio --quiet -H newc -o > '$(@)'" \
 	) | $(FAKEROOT) --
 	@echo "done."
diff --git a/rules/post/image_ext2.make b/rules/post/image_ext2.make
index 3e3423b..0dbcafd 100644
--- a/rules/post/image_ext2.make
+++ b/rules/post/image_ext2.make
@@ -15,7 +15,7 @@ ifdef PTXCONF_IMAGE_EXT2
 $(IMAGEDIR)/root.ext2: $(STATEDIR)/image_working_dir
 	@echo -n "Creating root.ext2 from working dir..."
 	@cd $(image/work_dir);						\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
 	(								\
 		echo -n "$(PTXCONF_SYSROOT_HOST)/bin/genext2fs ";	\
 		echo -n "-b $(PTXCONF_IMAGE_EXT2_SIZE) ";		\
diff --git a/rules/post/image_jffs2.make b/rules/post/image_jffs2.make
index 5e448f5..7f12883 100644
--- a/rules/post/image_jffs2.make
+++ b/rules/post/image_jffs2.make
@@ -17,7 +17,7 @@ $(IMAGEDIR)/root.jffs2: $(STATEDIR)/image_working_dir $(STATEDIR)/host-mtd-utils
 	@echo -n "(--eraseblock=$(PTXCONF_IMAGE_JFFS2_BLOCKSIZE) "
 	@echo "$(call remove_quotes,$(PTXCONF_IMAGE_JFFS2_EXTRA_ARGS)))"
 	@cd $(image/work_dir);						\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
 	(								\
 		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mkfs.jffs2 ";	\
 		echo -n "-d $(image/work_dir) ";			\
diff --git a/rules/post/image_squashfs.make b/rules/post/image_squashfs.make
index 6d02255..69dc721 100644
--- a/rules/post/image_squashfs.make
+++ b/rules/post/image_squashfs.make
@@ -19,7 +19,7 @@ ifdef PTXCONF_IMAGE_SQUASHFS
 $(IMAGEDIR)/root.squashfs: $(STATEDIR)/image_working_dir $(STATEDIR)/host-squashfs-tools.install.post
 	@echo -n "Creating root.squashfs from working dir..."
 	@cd $(image/work_dir);							\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&			\
 	(								\
 		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mksquashfs ";	\
 		echo -n "$(image/work_dir) ";					\
diff --git a/rules/post/image_tgz.make b/rules/post/image_tgz.make
index 57f69f4..bace4da 100644
--- a/rules/post/image_tgz.make
+++ b/rules/post/image_tgz.make
@@ -18,10 +18,10 @@ endif
 
 $(IMAGEDIR)/root.tgz: $(STATEDIR)/image_working_dir
 	@echo -n 'Creating root.tgz from working dir$(if $(IMAGE_TGZ_LABEL), with label "$(IMAGE_TGZ_LABEL)",)... '
-	@cd $(image/work_dir);							\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&		\
+	@cd $(image/work_dir);					\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&		\
 	(	echo -n "tar ${IMAGE_TGZ_LABEL_ARGS} -zcf ";	\
-		echo -n "$@ ." )					\
+		echo -n "$@ ." )				\
 	) | $(FAKEROOT) --
 	@echo "done."
 endif
diff --git a/rules/post/image_ubi.make b/rules/post/image_ubi.make
index edfae1d..17321dc 100644
--- a/rules/post/image_ubi.make
+++ b/rules/post/image_ubi.make
@@ -22,7 +22,7 @@ $(IMAGEDIR)/root.ubifs: $(STATEDIR)/image_working_dir $(STATEDIR)/host-mtd-utils
 	@echo -n "-e $(PTXCONF_IMAGE_UBIFS_LEB_SIZE) -c $(PTXCONF_IMAGE_UBIFS_ROOT_MAX_LEB_COUNT) "
 	@echo -n "$(PTXCONF_IMAGE_UBIFS_EXTRA_ARGS))"
 	@cd $(image/work_dir);								\
-	(awk -F: $(DOPERMISSIONS) $(image/permissions) &&			\
+	(awk $(DOPERMISSIONS) $(image/permissions) &&				\
 	(									\
 		echo -n "$(PTXCONF_SYSROOT_HOST)/sbin/mkfs.ubifs ";		\
 		echo -n "-d $(image/work_dir) ";					\
diff --git a/rules/post/ptxd_make_image_common.make b/rules/post/ptxd_make_image_common.make
index 7ccb501..0f274bf 100644
--- a/rules/post/ptxd_make_image_common.make
+++ b/rules/post/ptxd_make_image_common.make
@@ -8,7 +8,7 @@
 # see the README file.
 #
 
-DOPERMISSIONS := '{	\
+DOPERMISSIONS := '{ FS = "\x1F";	\
 	if ($$1 == "f")	\
 		printf("chmod %s \".%s\"; chown %s.%s \".%s\";\n", $$5, $$2, $$3, $$4, $$2);	\
 	if ($$1 == "n")	\
diff --git a/scripts/lib/ptxd_lib_dopermissions.awk b/scripts/lib/ptxd_lib_dopermissions.awk
index 336948c..3596121 100755
--- a/scripts/lib/ptxd_lib_dopermissions.awk
+++ b/scripts/lib/ptxd_lib_dopermissions.awk
@@ -1,7 +1,7 @@
 #!/usr/bin/awk -f
 
 BEGIN {
-	FS = ":";
+	FS = "\x1F";
 }
 
 $1 ~ "f" {
diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh
index 0a1e807..c5ebf7e 100644
--- a/scripts/lib/ptxd_make_image_fix_permissions.sh
+++ b/scripts/lib/ptxd_make_image_fix_permissions.sh
@@ -32,10 +32,12 @@ export -f ptxd_make_image_fix_permissions_generate
 ptxd_make_image_fix_permissions_check() {
     local workdir="${1}"
     local ifs_orig="${IFS}"
-    IFS=":"
+    IFS="\x1F"
+
+    ptxd_check_obsolete_perm "${ptxd_reply_perm_files[@]}"
 
     # just care about dev-nodes, for now
-    egrep -h "^[n]:" "${ptxd_reply_perm_files[@]}" |
+    egrep -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
     while read kind file uid_should gid_should prm_should type major_should minor_should; do
 	local fixup=false
 	file="${workdir}/${file#/}"
diff --git a/scripts/lib/ptxd_make_xpkg_common.sh b/scripts/lib/ptxd_make_xpkg_common.sh
index 279348f..c539ba4 100644
--- a/scripts/lib/ptxd_make_xpkg_common.sh
+++ b/scripts/lib/ptxd_make_xpkg_common.sh
@@ -19,6 +19,7 @@
 # $1: permissions file
 #
 ptxd_dopermissions() {
+	ptxd_check_obsolete_perm "${@}"
 	gawk -f "${PTXDIST_LIB_DIR}/ptxd_lib_dopermissions.awk" "${@}"
 }
 export -f ptxd_dopermissions
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index 9cb2784..f7e1a53 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -191,6 +191,7 @@ ptxd_install_setup_src() {
 export -f ptxd_install_setup_src
 
 ptxd_install_dir() {
+    local sep="\x1F"
     local dir="$1"
     local usr="$2"
     local grp="$3"
@@ -210,7 +211,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 -e "f${sep}${dir}${sep}${usr}${sep}${grp}${sep}${mod}" >> "${pkg_xpkg_perms}" ||
     ptxd_install_error "install_dir failed!"
 }
 export -f ptxd_install_dir
@@ -285,6 +286,7 @@ export -f ptxd_install_file_strip
 
 
 ptxd_install_file_impl() {
+    local sep="\x1F"
     local src="$1"
     local dst="$2"
     local usr="$3"
@@ -350,7 +352,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 -e "f${sep}${dst}${sep}${usr}${sep}${grp}${sep}${mod}" >> "${pkg_xpkg_perms}"
 }
 export -f ptxd_install_file_impl
 
@@ -392,6 +394,7 @@ install link:
 export -f ptxd_install_ln
 
 ptxd_install_mknod() {
+    local sep="\x1F"
     local dst="$1"
     local usr="$2"
     local grp="$3"
@@ -421,7 +424,7 @@ install device node:
     done &&
     chown "${usr}:${grp}" "${pdirs[@]/%/${dst}}" &&
 
-    echo "n:${dst}:${usr}:${grp}:${mod}:${type}:${major}:${minor}" >> "${pkg_xpkg_perms}"
+    echo -e "n${sep}${dst}${sep}${usr}${sep}${grp}${sep}${mod}${sep}${type}${sep}${major}${sep}${minor}" >> "${pkg_xpkg_perms}"
 }
 export -f ptxd_install_mknod
 
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index 7d158b7..be66e00 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -827,6 +827,17 @@ ptxd_lib_sysroot() {
 }
 export -f ptxd_lib_sysroot
 
+#
+# perm file separator changed to allow ':' in filenames
+#
+# $1: perm file path
+#
+ptxd_check_obsolete_perm() {
+	if ! grep -q -P "\x1F" "${1}"; then
+		ptxd_bailout "obsolete perm file detected, please run 'ptxdist clean root'"
+	fi
+}
+export -f ptxd_check_obsolete_perm
 
 #
 # split ipkg filename into it's parts
-- 
2.1.4


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH v2] use ^_ as separator in perms files
  2016-07-31 21:10       ` [ptxdist] [PATCH v2] " Ladislav Michl
@ 2016-08-03 10:23         ` Ladislav Michl
  2016-08-04  6:51           ` Michael Olbrich
  0 siblings, 1 reply; 10+ messages in thread
From: Ladislav Michl @ 2016-08-03 10:23 UTC (permalink / raw)
  To: ptxdist

On Sun, Jul 31, 2016 at 11:10:37PM +0200, Ladislav Michl wrote:
> Change separator to allow ':' in filenames.

As 2016.08 should be released this month and this patch needs carefull
review and testing, I'm gently pinging anyone responsible...

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH v2] use ^_ as separator in perms files
  2016-08-03 10:23         ` Ladislav Michl
@ 2016-08-04  6:51           ` Michael Olbrich
  2016-08-15 14:10             ` Ladislav Michl
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Olbrich @ 2016-08-04  6:51 UTC (permalink / raw)
  To: ptxdist

On Wed, Aug 03, 2016 at 12:23:04PM +0200, Ladislav Michl wrote:
> On Sun, Jul 31, 2016 at 11:10:37PM +0200, Ladislav Michl wrote:
> > Change separator to allow ':' in filenames.
> 
> As 2016.08 should be released this month and this patch needs carefull
> review and testing, I'm gently pinging anyone responsible...

I'm already testing it. Looks good so far. I just need to setup a test-case
to trigger the error path before I push it.

Michael

-- 
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH v2] use ^_ as separator in perms files
  2016-08-04  6:51           ` Michael Olbrich
@ 2016-08-15 14:10             ` Ladislav Michl
  2016-08-15 14:54               ` Michael Olbrich
  0 siblings, 1 reply; 10+ messages in thread
From: Ladislav Michl @ 2016-08-15 14:10 UTC (permalink / raw)
  To: ptxdist

On Thu, Aug 04, 2016 at 08:51:39AM +0200, Michael Olbrich wrote:
> I'm already testing it. Looks good so far. I just need to setup a test-case
> to trigger the error path before I push it.

Just tested, error path triggered, but 'ptxdist clean root' didn't help.
I had to delete *.perms files manually. Is it worth better fix or is it
enough just change error message?

	ladis

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH v2] use ^_ as separator in perms files
  2016-08-15 14:10             ` Ladislav Michl
@ 2016-08-15 14:54               ` Michael Olbrich
  2016-08-15 16:21                 ` Ladislav Michl
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Olbrich @ 2016-08-15 14:54 UTC (permalink / raw)
  To: ptxdist

On Mon, Aug 15, 2016 at 04:10:58PM +0200, Ladislav Michl wrote:
> On Thu, Aug 04, 2016 at 08:51:39AM +0200, Michael Olbrich wrote:
> > I'm already testing it. Looks good so far. I just need to setup a test-case
> > to trigger the error path before I push it.
> 
> Just tested, error path triggered, but 'ptxdist clean root' didn't help.
> I had to delete *.perms files manually. Is it worth better fix or is it
> enough just change error message?

Can you try to reproduce this? Clean root should trigger targetinstall for
all packages and new permission files should be created. For which image
did it fail?

Michael

-- 
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH v2] use ^_ as separator in perms files
  2016-08-15 14:54               ` Michael Olbrich
@ 2016-08-15 16:21                 ` Ladislav Michl
  0 siblings, 0 replies; 10+ messages in thread
From: Ladislav Michl @ 2016-08-15 16:21 UTC (permalink / raw)
  To: ptxdist

On Mon, Aug 15, 2016 at 04:54:47PM +0200, Michael Olbrich wrote:
> On Mon, Aug 15, 2016 at 04:10:58PM +0200, Ladislav Michl wrote:
> > Just tested, error path triggered, but 'ptxdist clean root' didn't help.
> > I had to delete *.perms files manually. Is it worth better fix or is it
> > enough just change error message?
> 
> Can you try to reproduce this? Clean root should trigger targetinstall for
> all packages and new permission files should be created. For which image
> did it fail?

I built DistroKit with 2016.07 and then switched to git version. Will try to
reproduce after update to Qt-5.7.0 gets more testing.

	ladis

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-08-15 16:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 11:22 [ptxdist] [PATCH] use ^_ as separator in perms files Ladislav Michl
2016-07-27 10:59 ` Michael Olbrich
2016-07-28 23:12   ` Ladislav Michl
2016-07-29  7:39     ` Michael Olbrich
2016-07-31 21:10       ` [ptxdist] [PATCH v2] " Ladislav Michl
2016-08-03 10:23         ` Ladislav Michl
2016-08-04  6:51           ` Michael Olbrich
2016-08-15 14:10             ` Ladislav Michl
2016-08-15 14:54               ` Michael Olbrich
2016-08-15 16:21                 ` Ladislav Michl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox