Patchwork [06/20] udev-cache: Remove superfluous subshell on extract

login
register
mail settings
Submitter Ben Shelton
Date Aug. 4, 2014, 6:40 p.m.
Message ID <6eee11939b5e229740cca413eaa741bfc85689c7.1407177403.git.ben.shelton@ni.com>
Download mbox | patch
Permalink /patch/77249/
State New
Headers show

Comments

Ben Shelton - Aug. 4, 2014, 6:40 p.m.
From: Richard Tollerton <rich.tollerton@ni.com>

tar -C exists in both GNU and busybox tar, so use that instead of
(cd /; tar ...). This allows the subshell to be removed.

Natinst-Rally-ID: TA44427
Acked-by: Gratian Crisan <gratian.crisan@ni.com>
Natinst-ReviewBoard-ID: 58620
Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
---
 meta/recipes-core/udev/udev/init       | 2 +-
 meta/recipes-core/udev/udev/udev-cache | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Otavio Salvador - Aug. 4, 2014, 7:33 p.m.
On Mon, Aug 4, 2014 at 3:40 PM, Ben Shelton <ben.shelton@ni.com> wrote:
> From: Richard Tollerton <rich.tollerton@ni.com>
>
> tar -C exists in both GNU and busybox tar, so use that instead of
> (cd /; tar ...). This allows the subshell to be removed.
>
> Natinst-Rally-ID: TA44427
> Acked-by: Gratian Crisan <gratian.crisan@ni.com>
> Natinst-ReviewBoard-ID: 58620
> Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
> ---


Acked-by: Otavio Salvador <otavio@ossystems.com.br>

Patch

diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index a96309d..bcb9040 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -69,7 +69,7 @@  case "$1" in
 		    readfiles /etc/udev/cache.data
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            (cd /; tar xzf $DEVCACHE --exclude=log)
+                            tar xzf $DEVCACHE -C / --exclude=log
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
                             [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 154d2ad..11c5f0e 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -25,7 +25,7 @@  fi
 
 if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
 	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
-	(cd /; tar czf "$DEVCACHE" dev)
+	tar czf "$DEVCACHE" dev -C / --exclude=log
 	mv /dev/shm/udev.cache /etc/udev/cache.data
 fi