Fix problem that change smack lable of /run to "*" 78/205178/1 accepted/tizen/unified/20190430.113501 submit/tizen/20190430.052724
authorINSUN PYO <insun.pyo@samsung.com>
Tue, 30 Apr 2019 04:29:49 +0000 (13:29 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Tue, 30 Apr 2019 04:29:49 +0000 (13:29 +0900)
Pre condition
- USB memory stick formatted with ext4.
- There should be no regular files.

Problem
- Smack lable of /run is changed to "*".

Cause
- "find $MOUNT_DIRECTORY -type f | xargs" return blank if there is no files.
- storaged runs on "/"
- "chsmack -a '*'" changes all files in the current directory.

Solution
- runs xargs with "-r" option.
- Man page of xargs: "If the standard input does not contain any nonblanks, do not run the command.  Normally, the command is run once even if there is no input.  This option is a GNU extension."

Change-Id: I642aaf84ea4752698eaa8be18fd105019779f86a

src/block/mmc-smack-label

index 70337cc..4ffc4da 100755 (executable)
@@ -4,9 +4,9 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
 source /etc/tizen-platform.conf
 MOUNT_DIRECTORY=$1
-find $MOUNT_DIRECTORY -type d | xargs chsmack -a '*' -t
-find $MOUNT_DIRECTORY -type f | xargs chsmack -a '*'
-find $MOUNT_DIRECTORY -type d | xargs chmod 777
-find $MOUNT_DIRECTORY -type f | xargs chmod 660
-find $MOUNT_DIRECTORY -type d | xargs chown root:priv_externalstorage
-find $MOUNT_DIRECTORY -type f | xargs chown root:priv_externalstorage
+find $MOUNT_DIRECTORY -type d | xargs -r chsmack -a '*' -t
+find $MOUNT_DIRECTORY -type f | xargs -r chsmack -a '*'
+find $MOUNT_DIRECTORY -type d | xargs -r chmod 777
+find $MOUNT_DIRECTORY -type f | xargs -r chmod 660
+find $MOUNT_DIRECTORY -type d | xargs -r chown root:priv_externalstorage
+find $MOUNT_DIRECTORY -type f | xargs -r chown root:priv_externalstorage