Skip to contentSkip to conversation

e2fsprogs/populate-extfs.sh: fix a problem on dash

PATCH In review Robert Yang 3 participants 4 messages Jan 20, 2014 – Jan 24, 2014

lore
Share & tools
lore
#0 lore raw

cover e2fsprogs/populate-extfs.sh: fix a problem on dash

The following changes since commit 9f7465db614c664c49904033aa70170278972932:

siggen.py: fix the SignatureGenerator() (2014-01-20 19:43:03 +0800)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib rbt/dash
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/dash

Robert Yang (1):
e2fsprogs/populate-extfs.sh: fix a problem on dash

 meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 e2fsprogs/populate-extfs.sh: fix a problem on dash

The dash can't handle the or [[ in parameter expansion, for example:

A=/usr/bin/[[
B=[[
C="${A%$B}"

The C should be "/usr/bin" in common, but it will be /usr/bin/[[ on dash, use dirname to fix it.

NOTE:
There are 3 lines about parameter expansion, only fix the DIR="${DIR%$TGT}" since the other 2 works will and are very useful in this case.

[YOCTO #5712]

---
 meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh +1 -1
index 7de720b..9b55a4b 100644
@@ -23,7 +23,7 @@ DEBUGFS="debugfs"
 	find $SRCDIR | while read FILE; do
                 TGT="${FILE##*/}"
                 DIR="${FILE#$SRCDIR}"
-                DIR="${DIR%$TGT}"
+                DIR="$(dirname $DIR)"
 
 		# Skip the root dir
 		[ ! -z "$DIR" ] || continue
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 14 lines · Robert Yang

The dash can't handle the or [[ in parameter expansion, for example:

A=/usr/bin/[[
B=[[
C="${A%$B}"

The C should be "/usr/bin" in common, but it will be /usr/bin/[[ on dash, use dirname to fix it.

NOTE:
There are 3 lines about parameter expansion, only fix the DIR="${DIR%$TGT}" since the other 2 works will and are very useful in this case.

Quoted 6 lines

[YOCTO #5712]

---
 meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I'm afraid I had to revert this as it caused other build failures:

http://autobuilder.yoctoproject.org/main/builders/build-appliance/builds/18/steps/BuildImages_1/logs/stdio

Can you look into why that happened and resent the patch please?

Cheers,

Richard

Quoted 13 lines
meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh +1 -1
index 7de720b..9b55a4b 100644
@@ -23,7 +23,7 @@ DEBUGFS="debugfs"
 	find $SRCDIR | while read FILE; do
                 TGT="${FILE##*/}"
                 DIR="${FILE#$SRCDIR}"
-                DIR="${DIR%$TGT}"
+                DIR="$(dirname $DIR)"
 
 		# Skip the root dir
 		[ ! -z "$DIR" ] || continue
#3 lore raw
Quoted 2 lines · Richard Purdie
Quoted 1 line · Robert Yang

The dash can't handle the or [[ in parameter expansion, for example:

Good to know. Interesting! Noting that escaping the [ would work, but not applicable in this case.

Quoted 4 lines
Quoted 4 lines

A=/usr/bin/[[
B=[[
C="${A%$B}"

Would ${A%/*}/ work?

- DIR="${DIR%$TGT}"
+ DIR="${DIR%/*}/"

It also has the advantage that it doesn't cause a fork (afaict, the loop is being executed for every file in a rootfs directory structure, that could cause a lot of forks).

(Disclaimer: I haven't tested this)

Signature · 1 line
olofjn