All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf
  2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
@ 2016-06-06 20:43 ` Yann E. MORIN
  2016-06-06 21:07   ` Thomas Petazzoni
  2016-06-06 20:43 ` [Buildroot] [PATCH 2/7] fs: properly escape commands when generating fakeroot script Yann E. MORIN
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 20:43 UTC (permalink / raw)
  To: buildroot

In some cases we need to escape make variables and pass them to
printf(1).

This is the case in our fs infra, where we want to shoe-horn the
commands to generate the filesystems in the fakeroot script, or the
devices, permissions and users tables to their respective files.

We currently do so by replacing $(sep) with the literal '\n' but that's
not enough. This does not protect against strings with an embedded '%'
or a backslash.

Add a new macro that properly escapes a string and calls printf(1), so
that we get the expected output.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/pkg-utils.mk | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index f88313a..c61b3b6 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -104,6 +104,43 @@ define sep
 
 endef
 
+PERCENT = %
+QUOTE = '
+# ' # Meh... syntax-highlighting
+
+# This macro properly escapes a command string, then prints it with printf:
+#
+#   - first, backslash '\' are self-escaped, so that they do not escape
+#     the following char and so that printf properly outputs a backslash;
+#
+#   - next, single quotes are escaped by closing an existing one, adding
+#     an escaped one, and re-openning a new one (see below for the reason);
+#
+#   - then '%' signs are self-escaped so that the printf does not interpret
+#     them as a format specifier, in case the variable contains an actual
+#     printf with a format;
+#
+#   - finally, $(sep) is replaced with the literal '\n' so that make does
+#     not break on the so-expanded variable, but so that the printf does
+#     correctly output an LF.
+#
+# Note: this must be escaped in this order to avoid over-escaping the
+# previously escaped elements.
+#
+# Once everything has been escaped, it is passed between single quotes
+# (that's why the single-quotes are escaped they way they are, above,
+# and why the dollar sign is not escaped) to printf(1). A trailing
+# newline is apended, too.
+#
+# Note: leading or trailing spaces are *not* stripped.
+#
+define PRINTF
+	printf '$(subst $(sep),\n,\
+			$(subst $(PERCENT),$(PERCENT)$(PERCENT),\
+				$(subst $(QUOTE),$(QUOTE)\$(QUOTE)$(QUOTE),\
+					$(subst \,\\,$(1)))))\n'
+endef
+
 # check-deprecated-variable -- throw an error on deprecated variables
 # example:
 #   $(eval $(call check-deprecated-variable,FOO_MAKE_OPT,FOO_MAKE_OPTS))
-- 
2.7.4

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

* [Buildroot] [PATCH 2/7] fs: properly escape commands when generating fakeroot script
  2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
  2016-06-06 20:43 ` [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf Yann E. MORIN
@ 2016-06-06 20:43 ` Yann E. MORIN
  2016-06-06 20:43 ` [Buildroot] [PATCH 3/7] fs/cloop: split long line Yann E. MORIN
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 20:43 UTC (permalink / raw)
  To: buildroot

Use the newly-introduced PRINTF macro to generate printf formats
that do "The Right Thing (TM)".

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 fs/common.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/common.mk b/fs/common.mk
index 46e097b..f7a73bb 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -81,17 +81,17 @@ $$(BINARIES_DIR)/rootfs.$(1): target-finalize $$(ROOTFS_$(2)_DEPENDENCIES)
 ifneq ($$(ROOTFS_USERS_TABLES),)
 	cat $$(ROOTFS_USERS_TABLES) >> $$(USERS_TABLE)
 endif
-	printf '$$(subst $$(sep),\n,$$(PACKAGES_USERS))' >> $$(USERS_TABLE)
+	$$(call PRINTF,$$(PACKAGES_USERS)) >> $$(USERS_TABLE)
 	PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers $$(USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT)
 ifneq ($$(ROOTFS_DEVICE_TABLES),)
 	cat $$(ROOTFS_DEVICE_TABLES) > $$(FULL_DEVICE_TABLE)
 ifeq ($$(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
-	printf '$$(subst $$(sep),\n,$$(PACKAGES_DEVICES_TABLE))' >> $$(FULL_DEVICE_TABLE)
+	$$(call PRINTF,$$(PACKAGES_DEVICES_TABLE)) >> $$(FULL_DEVICE_TABLE)
 endif
-	printf '$$(subst $$(sep),\n,$$(PACKAGES_PERMISSIONS_TABLE))' >> $$(FULL_DEVICE_TABLE)
+	$$(call PRINTF,$$(PACKAGES_PERMISSIONS_TABLE)) >> $$(FULL_DEVICE_TABLE)
 	echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
 endif
-	echo "$$(ROOTFS_$(2)_CMD)" >> $$(FAKEROOT_SCRIPT)
+	$$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)
 	chmod a+x $$(FAKEROOT_SCRIPT)
 	PATH=$$(BR_PATH) $$(HOST_DIR)/usr/bin/fakeroot -- $$(FAKEROOT_SCRIPT)
 	$$(INSTALL) -m 0644 support/misc/target-dir-warning.txt $$(TARGET_DIR_WARNING_FILE)
-- 
2.7.4

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

* [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes)
@ 2016-06-06 20:43 Yann E. MORIN
  2016-06-06 20:43 ` [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf Yann E. MORIN
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 20:43 UTC (permalink / raw)
  To: buildroot

Hello All!

This short series pre-emptively fixes the fs infra when generating the
fakeroot script and the users, devices and permissions tables.

This allows a few cosmetic simplifications in some of our filesystem
commands.

Regards,
Yann E. MORIN.


The following changes since commit 7dcec609ee0f4a17a25533c443f1db3483abe720

  uclibc: the internal toolchain only uses uClibc-ng (2016-06-06 22:26:08 +0200)


are available in the git repository at:

  https://git.busybox.net/~ymorin/git/buildroot

for you to fetch changes up to d4b5c7f0315f28e792a014983c78b1fe4958eb9f

  fs/squashfs: remove useless chmod (2016-06-06 22:32:59 +0200)


----------------------------------------------------------------
Yann E. MORIN (7):
      core/pkg-utils: add macro to escape-and-printf
      fs: properly escape commands when generating fakeroot script
      fs/cloop: split long line
      fs/jffs2: split commands
      fs/squashfs: split commands
      fs/ubifs: fix the UBI commands
      fs/squashfs: remove useless chmod

 fs/cloop/cloop.mk       |  5 +++--
 fs/common.mk            |  8 ++++----
 fs/jffs2/jffs2.mk       |  4 ++--
 fs/squashfs/squashfs.mk |  3 +--
 fs/ubifs/ubi.mk         |  6 +++---
 package/pkg-utils.mk    | 37 +++++++++++++++++++++++++++++++++++++
 6 files changed, 50 insertions(+), 13 deletions(-)

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 3/7] fs/cloop: split long line
  2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
  2016-06-06 20:43 ` [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf Yann E. MORIN
  2016-06-06 20:43 ` [Buildroot] [PATCH 2/7] fs: properly escape commands when generating fakeroot script Yann E. MORIN
@ 2016-06-06 20:43 ` Yann E. MORIN
  2016-06-06 21:19   ` Thomas Petazzoni
  2016-06-06 20:43 ` [Buildroot] [PATCH 4/7] fs/jffs2: split commands Yann E. MORIN
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 20:43 UTC (permalink / raw)
  To: buildroot

.. and add the missing newline-at-end-of-file.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 fs/cloop/cloop.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/cloop/cloop.mk b/fs/cloop/cloop.mk
index f783ade..9e42a3a 100644
--- a/fs/cloop/cloop.mk
+++ b/fs/cloop/cloop.mk
@@ -7,7 +7,8 @@
 ROOTFS_CLOOP_DEPENDENCIES = host-cloop host-cdrkit
 
 define ROOTFS_CLOOP_CMD
-	$(HOST_DIR)/usr/bin/genisoimage -r $(TARGET_DIR) | $(HOST_DIR)/usr/bin/create_compressed_fs - 65536 > $@
+	$(HOST_DIR)/usr/bin/genisoimage -r $(TARGET_DIR) | \
+		$(HOST_DIR)/usr/bin/create_compressed_fs - 65536 > $@
 endef
 
-$(eval $(call ROOTFS_TARGET,cloop))
\ No newline at end of file
+$(eval $(call ROOTFS_TARGET,cloop))
-- 
2.7.4

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

* [Buildroot] [PATCH 4/7] fs/jffs2: split commands
  2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
                   ` (2 preceding siblings ...)
  2016-06-06 20:43 ` [Buildroot] [PATCH 3/7] fs/cloop: split long line Yann E. MORIN
@ 2016-06-06 20:43 ` Yann E. MORIN
  2016-06-06 20:43 ` [Buildroot] [PATCH 5/7] fs/squashfs: " Yann E. MORIN
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 20:43 UTC (permalink / raw)
  To: buildroot

Now that we can properly printf a multi-line command, there is no need
to use a single command to gnerate the jffs2 image.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 fs/jffs2/jffs2.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/jffs2/jffs2.mk b/fs/jffs2/jffs2.mk
index a9cd414..9a36a75 100644
--- a/fs/jffs2/jffs2.mk
+++ b/fs/jffs2/jffs2.mk
@@ -39,8 +39,8 @@ ROOTFS_JFFS2_DEPENDENCIES = host-mtd
 
 ifneq ($(BR2_TARGET_ROOTFS_JFFS2_SUMMARY),)
 define ROOTFS_JFFS2_CMD
-	$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $@.nosummary && \
-	$(SUMTOOL) $(SUMTOOL_OPTS) -i $@.nosummary -o $@ && \
+	$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $@.nosummary
+	$(SUMTOOL) $(SUMTOOL_OPTS) -i $@.nosummary -o $@
 	rm $@.nosummary
 endef
 else
-- 
2.7.4

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

* [Buildroot] [PATCH 5/7] fs/squashfs: split commands
  2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
                   ` (3 preceding siblings ...)
  2016-06-06 20:43 ` [Buildroot] [PATCH 4/7] fs/jffs2: split commands Yann E. MORIN
@ 2016-06-06 20:43 ` Yann E. MORIN
  2016-06-06 20:43 ` [Buildroot] [PATCH 6/7] fs/ubifs: fix the UBI commands Yann E. MORIN
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 20:43 UTC (permalink / raw)
  To: buildroot

Now that we can properly printf a multi-line command, there is no need
to use a single command to gnerate the squashfs image.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 fs/squashfs/squashfs.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/squashfs/squashfs.mk b/fs/squashfs/squashfs.mk
index a71d9cc..eadbb8f 100644
--- a/fs/squashfs/squashfs.mk
+++ b/fs/squashfs/squashfs.mk
@@ -26,7 +26,7 @@ endif
 
 define ROOTFS_SQUASHFS_CMD
 	$(HOST_DIR)/usr/bin/mksquashfs $(TARGET_DIR) $@ -noappend \
-		$(ROOTFS_SQUASHFS_ARGS) && \
+		$(ROOTFS_SQUASHFS_ARGS)
 	chmod 0644 $@
 endef
 
-- 
2.7.4

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

* [Buildroot] [PATCH 6/7] fs/ubifs: fix the UBI commands
  2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
                   ` (4 preceding siblings ...)
  2016-06-06 20:43 ` [Buildroot] [PATCH 5/7] fs/squashfs: " Yann E. MORIN
@ 2016-06-06 20:43 ` Yann E. MORIN
  2016-06-06 20:43 ` [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod Yann E. MORIN
  2016-06-07 20:27 ` [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Thomas Petazzoni
  7 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 20:43 UTC (permalink / raw)
  To: buildroot

We can now properly use multi-line commands, so use that.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 fs/ubifs/ubi.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ubifs/ubi.mk b/fs/ubifs/ubi.mk
index aba3bea..cda4bf4 100644
--- a/fs/ubifs/ubi.mk
+++ b/fs/ubifs/ubi.mk
@@ -21,9 +21,9 @@ UBINIZE_CONFIG_FILE_PATH = fs/ubifs/ubinize.cfg
 endif
 
 define ROOTFS_UBI_CMD
-	$(INSTALL) -m 0644 $(UBINIZE_CONFIG_FILE_PATH) $(BUILD_DIR)/ubinize.cfg ;\
-	$(SED) 's;BR2_ROOTFS_UBIFS_PATH;$@fs;' $(BUILD_DIR)/ubinize.cfg ;\
-	$(HOST_DIR)/usr/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) $(BUILD_DIR)/ubinize.cfg ;\
+	$(INSTALL) -m 0644 $(UBINIZE_CONFIG_FILE_PATH) $(BUILD_DIR)/ubinize.cfg
+	$(SED) 's;BR2_ROOTFS_UBIFS_PATH;$@fs;' $(BUILD_DIR)/ubinize.cfg
+	$(HOST_DIR)/usr/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) $(BUILD_DIR)/ubinize.cfg
 	rm $(BUILD_DIR)/ubinize.cfg
 endef
 
-- 
2.7.4

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

* [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod
  2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
                   ` (5 preceding siblings ...)
  2016-06-06 20:43 ` [Buildroot] [PATCH 6/7] fs/ubifs: fix the UBI commands Yann E. MORIN
@ 2016-06-06 20:43 ` Yann E. MORIN
  2016-06-06 21:01   ` Peter Korsgaard
  2016-06-06 21:06   ` Thomas Petazzoni
  2016-06-07 20:27 ` [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Thomas Petazzoni
  7 siblings, 2 replies; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 20:43 UTC (permalink / raw)
  To: buildroot

When that was added (in 975e30b, fs/squashfs: fix image file
permissions), the reasons were not quite explicit.

We are now forcing the umask, and various tests have shown that the mode
on the generated image file are correct without the chmod.

Remove it.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Peter Korsgaard <peter@korsgaard.com>
---
 fs/squashfs/squashfs.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/squashfs/squashfs.mk b/fs/squashfs/squashfs.mk
index eadbb8f..c4d9ca5 100644
--- a/fs/squashfs/squashfs.mk
+++ b/fs/squashfs/squashfs.mk
@@ -27,7 +27,6 @@ endif
 define ROOTFS_SQUASHFS_CMD
 	$(HOST_DIR)/usr/bin/mksquashfs $(TARGET_DIR) $@ -noappend \
 		$(ROOTFS_SQUASHFS_ARGS)
-	chmod 0644 $@
 endef
 
 $(eval $(call ROOTFS_TARGET,squashfs))
-- 
2.7.4

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

* [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod
  2016-06-06 20:43 ` [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod Yann E. MORIN
@ 2016-06-06 21:01   ` Peter Korsgaard
  2016-06-06 21:28     ` Yann E. MORIN
  2016-06-06 21:06   ` Thomas Petazzoni
  1 sibling, 1 reply; 19+ messages in thread
From: Peter Korsgaard @ 2016-06-06 21:01 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > When that was added (in 975e30b, fs/squashfs: fix image file
 > permissions), the reasons were not quite explicit.

The git hash is wrong, it was 3975e30b9.

 > We are now forcing the umask, and various tests have shown that the mode
 > on the generated image file are correct without the chmod.

 > Remove it.

 > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 > Cc: Peter Korsgaard <peter@korsgaard.com>

otherwise it looks good.

Acked-by: Peter Korsgaard <peter@korsgaard.com>

> ---
 >  fs/squashfs/squashfs.mk | 1 -
 >  1 file changed, 1 deletion(-)

 > diff --git a/fs/squashfs/squashfs.mk b/fs/squashfs/squashfs.mk
 > index eadbb8f..c4d9ca5 100644
 > --- a/fs/squashfs/squashfs.mk
 > +++ b/fs/squashfs/squashfs.mk
 > @@ -27,7 +27,6 @@ endif
 >  define ROOTFS_SQUASHFS_CMD
 >  	$(HOST_DIR)/usr/bin/mksquashfs $(TARGET_DIR) $@ -noappend \
 >  		$(ROOTFS_SQUASHFS_ARGS)
 > -	chmod 0644 $@
 >  endef
 
 >  $(eval $(call ROOTFS_TARGET,squashfs))
 > -- 
 > 2.7.4



-- 
Venlig hilsen,
Peter Korsgaard 

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

* [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod
  2016-06-06 20:43 ` [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod Yann E. MORIN
  2016-06-06 21:01   ` Peter Korsgaard
@ 2016-06-06 21:06   ` Thomas Petazzoni
  2016-06-06 21:16     ` Yann E. MORIN
  1 sibling, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2016-06-06 21:06 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon,  6 Jun 2016 22:43:44 +0200, Yann E. MORIN wrote:
> When that was added (in 975e30b, fs/squashfs: fix image file

There is no such commit as 975e30b:

~/projets/buildroot (master)$ git show 975e30b
fatal: ambiguous argument '975e30b': unknown revision or path not in
the working tree. Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

> permissions), the reasons were not quite explicit.

I very well remember that mksquashfs had the very annoying default
behavior of making its output file 0444. Like because it was a
read-only filesystem, the images should also be read-only, which is
obviously a bit silly.

Maybe mksquashfs has changed its default behavior since then, but
clearly that's the reason why we were doing this.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf
  2016-06-06 20:43 ` [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf Yann E. MORIN
@ 2016-06-06 21:07   ` Thomas Petazzoni
  2016-06-06 21:25     ` Yann E. MORIN
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2016-06-06 21:07 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon,  6 Jun 2016 22:43:38 +0200, Yann E. MORIN wrote:

> +define PRINTF
> +	printf '$(subst $(sep),\n,\
> +			$(subst $(PERCENT),$(PERCENT)$(PERCENT),\
> +				$(subst $(QUOTE),$(QUOTE)\$(QUOTE)$(QUOTE),\
> +					$(subst \,\\,$(1)))))\n'
> +endef

Do we expect this to be used outside of fs/common.mk? Since it's not
the case today, I would suggest to move it there.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod
  2016-06-06 21:06   ` Thomas Petazzoni
@ 2016-06-06 21:16     ` Yann E. MORIN
  2016-06-07 12:51       ` Peter Korsgaard
  0 siblings, 1 reply; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 21:16 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-06-06 23:06 +0200, Thomas Petazzoni spake thusly:
> On Mon,  6 Jun 2016 22:43:44 +0200, Yann E. MORIN wrote:
> > When that was added (in 975e30b, fs/squashfs: fix image file
> 
> There is no such commit as 975e30b:

Right, the leading '3' got lost in a bad copy-paste...

    $ git show --no-patch 3975e30b
    commit 3975e30b991d42d4cc153b738742f962d8fda757
    Author: Peter Korsgaard <jacmet@sunsite.dk>
    Date:   Tue Aug 31 21:53:40 2010 +0200

        fs/squashfs: fix image file permissions
    
        Set image file permissions to 0644 like it was before the fs rework,
        instead of the rather unhelpful 0700 (E.G. when image is used for tftp).
    
        Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>

As already noticed by Peter.

> ~/projets/buildroot (master)$ git show 975e30b
> fatal: ambiguous argument '975e30b': unknown revision or path not in
> the working tree. Use '--' to separate paths from revisions, like this:
> 'git <command> [<revision>...] -- [<file>...]'
> 
> > permissions), the reasons were not quite explicit.
> 
> I very well remember that mksquashfs had the very annoying default
> behavior of making its output file 0444. Like because it was a
> read-only filesystem, the images should also be read-only, which is
> obviously a bit silly.

OK, that's good to know.

> Maybe mksquashfs has changed its default behavior since then, but
> clearly that's the reason why we were doing this.

At least, that's not what I can see here...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 3/7] fs/cloop: split long line
  2016-06-06 20:43 ` [Buildroot] [PATCH 3/7] fs/cloop: split long line Yann E. MORIN
@ 2016-06-06 21:19   ` Thomas Petazzoni
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Petazzoni @ 2016-06-06 21:19 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon,  6 Jun 2016 22:43:40 +0200, Yann E. MORIN wrote:
> .. and add the missing newline-at-end-of-file.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  fs/cloop/cloop.mk | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf
  2016-06-06 21:07   ` Thomas Petazzoni
@ 2016-06-06 21:25     ` Yann E. MORIN
  2016-06-06 22:54       ` Arnout Vandecappelle
  0 siblings, 1 reply; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 21:25 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-06-06 23:07 +0200, Thomas Petazzoni spake thusly:
> On Mon,  6 Jun 2016 22:43:38 +0200, Yann E. MORIN wrote:
> 
> > +define PRINTF
> > +	printf '$(subst $(sep),\n,\
> > +			$(subst $(PERCENT),$(PERCENT)$(PERCENT),\
> > +				$(subst $(QUOTE),$(QUOTE)\$(QUOTE)$(QUOTE),\
> > +					$(subst \,\\,$(1)))))\n'
> > +endef
> 
> Do we expect this to be used outside of fs/common.mk? Since it's not
> the case today, I would suggest to move it there.

Indeed I don;t plan on using it outside of the fs infra for now (I have
another series that will rely on it, but still in the fs infra).

However, this is generic enough that it is not specific to the fs infra.
Thus I believe it belong to pkg-utils.

If you still prefer I move it to fs/common.mk, that's also OK for me.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod
  2016-06-06 21:01   ` Peter Korsgaard
@ 2016-06-06 21:28     ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-06 21:28 UTC (permalink / raw)
  To: buildroot

Peter, All,

On 2016-06-06 23:01 +0200, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> 
>  > When that was added (in 975e30b, fs/squashfs: fix image file
>  > permissions), the reasons were not quite explicit.
> 
> The git hash is wrong, it was 3975e30b9.

Good catch!

Regards,
Yann E. MORIN.

>  > We are now forcing the umask, and various tests have shown that the mode
>  > on the generated image file are correct without the chmod.
> 
>  > Remove it.
> 
>  > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>  > Cc: Peter Korsgaard <peter@korsgaard.com>
> 
> otherwise it looks good.
> 
> Acked-by: Peter Korsgaard <peter@korsgaard.com>
> 
> > ---
>  >  fs/squashfs/squashfs.mk | 1 -
>  >  1 file changed, 1 deletion(-)
> 
>  > diff --git a/fs/squashfs/squashfs.mk b/fs/squashfs/squashfs.mk
>  > index eadbb8f..c4d9ca5 100644
>  > --- a/fs/squashfs/squashfs.mk
>  > +++ b/fs/squashfs/squashfs.mk
>  > @@ -27,7 +27,6 @@ endif
>  >  define ROOTFS_SQUASHFS_CMD
>  >  	$(HOST_DIR)/usr/bin/mksquashfs $(TARGET_DIR) $@ -noappend \
>  >  		$(ROOTFS_SQUASHFS_ARGS)
>  > -	chmod 0644 $@
>  >  endef
>  
>  >  $(eval $(call ROOTFS_TARGET,squashfs))
>  > -- 
>  > 2.7.4
> 
> 
> 
> -- 
> Venlig hilsen,
> Peter Korsgaard 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf
  2016-06-06 21:25     ` Yann E. MORIN
@ 2016-06-06 22:54       ` Arnout Vandecappelle
  0 siblings, 0 replies; 19+ messages in thread
From: Arnout Vandecappelle @ 2016-06-06 22:54 UTC (permalink / raw)
  To: buildroot

On 06-06-16 23:25, Yann E. MORIN wrote:
> Thomas, All,
> 
> On 2016-06-06 23:07 +0200, Thomas Petazzoni spake thusly:
>> On Mon,  6 Jun 2016 22:43:38 +0200, Yann E. MORIN wrote:
>>
>>> +define PRINTF
>>> +	printf '$(subst $(sep),\n,\
>>> +			$(subst $(PERCENT),$(PERCENT)$(PERCENT),\
>>> +				$(subst $(QUOTE),$(QUOTE)\$(QUOTE)$(QUOTE),\
>>> +					$(subst \,\\,$(1)))))\n'
>>> +endef
>>
>> Do we expect this to be used outside of fs/common.mk? Since it's not
>> the case today, I would suggest to move it there.
> 
> Indeed I don;t plan on using it outside of the fs infra for now (I have
> another series that will rely on it, but still in the fs infra).
> 
> However, this is generic enough that it is not specific to the fs infra.
> Thus I believe it belong to pkg-utils.
> 
> If you still prefer I move it to fs/common.mk, that's also OK for me.

 I think pkg-utils is the proper place. I imagine that there can be many other
places where this can be useful. And even if it is only used in the fs infra, I
would go and look for a function like that in pkg-utils.mk.

 Regards,
 Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod
  2016-06-06 21:16     ` Yann E. MORIN
@ 2016-06-07 12:51       ` Peter Korsgaard
  2016-06-07 19:12         ` Yann E. MORIN
  0 siblings, 1 reply; 19+ messages in thread
From: Peter Korsgaard @ 2016-06-07 12:51 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

Hi,

 >> Maybe mksquashfs has changed its default behavior since then, but
 >> clearly that's the reason why we were doing this.

 > At least, that's not what I can see here...

No, it seems to use sensible permissions nowadays:

strace -e open mksquashfs /tmp/blah /tmp/test.squashfs
..
open("/tmp/test.squashfs", O_RDWR|O_CREAT|O_TRUNC, 0644) = 3
open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 4
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on /tmp/test.squashfs, block size 131072.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod
  2016-06-07 12:51       ` Peter Korsgaard
@ 2016-06-07 19:12         ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2016-06-07 19:12 UTC (permalink / raw)
  To: buildroot

On 2016-06-07 14:51 +0200, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> 
> Hi,
> 
>  >> Maybe mksquashfs has changed its default behavior since then, but
>  >> clearly that's the reason why we were doing this.
> 
>  > At least, that's not what I can see here...
> 
> No, it seems to use sensible permissions nowadays:
> 
> strace -e open mksquashfs /tmp/blah /tmp/test.squashfs
> ..
> open("/tmp/test.squashfs", O_RDWR|O_CREAT|O_TRUNC, 0644) = 3
> open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 4
> Parallel mksquashfs: Using 4 processors
> Creating 4.0 filesystem on /tmp/test.squashfs, block size 131072.

Exactly what I meant: mksquashfs now behaves correctly. I don;t observe
this fiddling with acces rights any more.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes)
  2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
                   ` (6 preceding siblings ...)
  2016-06-06 20:43 ` [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod Yann E. MORIN
@ 2016-06-07 20:27 ` Thomas Petazzoni
  7 siblings, 0 replies; 19+ messages in thread
From: Thomas Petazzoni @ 2016-06-07 20:27 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon,  6 Jun 2016 22:43:40 +0200, Yann E. MORIN wrote:

> Yann E. MORIN (7):
>       core/pkg-utils: add macro to escape-and-printf
>       fs: properly escape commands when generating fakeroot script
>       fs/cloop: split long line
>       fs/jffs2: split commands
>       fs/squashfs: split commands
>       fs/ubifs: fix the UBI commands
>       fs/squashfs: remove useless chmod

Entire series applied, thanks! I had already applied one patch, I've
simply applied all remaining ones.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2016-06-07 20:27 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 20:43 [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Yann E. MORIN
2016-06-06 20:43 ` [Buildroot] [PATCH 1/7] core/pkg-utils: add macro to escape-and-printf Yann E. MORIN
2016-06-06 21:07   ` Thomas Petazzoni
2016-06-06 21:25     ` Yann E. MORIN
2016-06-06 22:54       ` Arnout Vandecappelle
2016-06-06 20:43 ` [Buildroot] [PATCH 2/7] fs: properly escape commands when generating fakeroot script Yann E. MORIN
2016-06-06 20:43 ` [Buildroot] [PATCH 3/7] fs/cloop: split long line Yann E. MORIN
2016-06-06 21:19   ` Thomas Petazzoni
2016-06-06 20:43 ` [Buildroot] [PATCH 4/7] fs/jffs2: split commands Yann E. MORIN
2016-06-06 20:43 ` [Buildroot] [PATCH 5/7] fs/squashfs: " Yann E. MORIN
2016-06-06 20:43 ` [Buildroot] [PATCH 6/7] fs/ubifs: fix the UBI commands Yann E. MORIN
2016-06-06 20:43 ` [Buildroot] [PATCH 7/7] fs/squashfs: remove useless chmod Yann E. MORIN
2016-06-06 21:01   ` Peter Korsgaard
2016-06-06 21:28     ` Yann E. MORIN
2016-06-06 21:06   ` Thomas Petazzoni
2016-06-06 21:16     ` Yann E. MORIN
2016-06-07 12:51       ` Peter Korsgaard
2016-06-07 19:12         ` Yann E. MORIN
2016-06-07 20:27 ` [Buildroot] [PATCH 0/7] fs: cleanups (branch yem/fs-fixes) Thomas Petazzoni

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.