Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] v2: Move pseudo directory out of its filesystem
@ 2012-08-23  1:47 Peter Seebach
  2012-08-23  1:47 ` [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs Peter Seebach
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Seebach @ 2012-08-23  1:47 UTC (permalink / raw)
  To: openembedded-core

The intent has been that pseudo's database be outside the hunk of space
it's trying to maintain -- we don't want an NFS-exported rootfs getting
its permissions destroyed by target apps! Based on feedback from v1,
I now use a name which uses the name of the rootfs so it's easier to
connect pseudo_state dirs to the rootfs, and also to have more than one
rootfs within a given directory.

The following changes since commit 4ef8960c8d2876914bb78cbdce5fae3c5297e942:
  Khem Raj (1):
        gcc-cross-intermediate, gcc-crosssdk-intermediate: Remove

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib seebs/varpseudo
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/varpseudo

Peter Seebach (1):
  runqemu-export-rootfs and friends: don't put pseudo db in target fs

 .../installer/adt-installer/scripts/extract_rootfs |    8 ++++----
 scripts/runqemu-export-rootfs                      |    2 +-
 scripts/runqemu-extract-sdk                        |   15 +++++++++------
 3 files changed, 14 insertions(+), 11 deletions(-)




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

* [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs
  2012-08-23  1:47 [PATCH 0/1] v2: Move pseudo directory out of its filesystem Peter Seebach
@ 2012-08-23  1:47 ` Peter Seebach
  2012-08-24  7:31   ` Scott Garman
  2012-08-24 19:55   ` Peter Seebach
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Seebach @ 2012-08-23  1:47 UTC (permalink / raw)
  To: openembedded-core

In a few places, we have scripts which use <rootfs>/var/pseudo for
the pseudo state directory controlling a given filesystem. This
seems possibly risky because it means that stuff running under
qemu or whatnot could wipe out the data being used to handle that
rootfs. Move this to:
  <rootfs>/../pseudo_state_$(basename $rootfs)
to avoid problems.

This also solves at least one case (not directly hit by yocto's
tree) wherein you could end up trying to remove a rootfs while
pseudo was using a database inside that rootfs, and thus the
remove would fail.

Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
---
 .../installer/adt-installer/scripts/extract_rootfs |    8 ++++----
 scripts/runqemu-export-rootfs                      |    2 +-
 scripts/runqemu-extract-sdk                        |   15 +++++++++------
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
index 62dc170..fee463c 100755
--- a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
@@ -28,7 +28,6 @@ extract_rootfs()
   native_sysroot=$3
   target_sysroot=$2
   PSEUDO_COMMAND="$native_sysroot/usr/bin/pseudo"
-  PSEUDO_OPTS="-P $natvie_sysroot/usr"
   TAR_OPTS="-xjf"
   PSEUDO_OPTS="-P $native_sysroot/usr"
 
@@ -46,9 +45,10 @@ extract_rootfs()
     mkdir -p "$target_sysroot"
   fi
 
-  mkdir -p "$target_sysroot/var/pseudo"
-  touch "$target_sysroot/var/pseudo/pseudo.pid"
-  PSEUDO_LOCALSTATEDIR="$target_sysroot/var/pseudo"
+  pseudo_state_dir="$target_sysroot/../pseudo_state_$(basename "$target_sysroot")"
+  mkdir -p "$pseudo_state_dir"
+  touch "$pseudo_state_dir/pseudo.pid"
+  PSEUDO_LOCALSTATEDIR="$pseudo_state_dir"
   export PSEUDO_LOCALSTATEDIR
 
   echo_info "Extracting rootfs: $1, using pseudo..."
diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
index f8213ba..0e0d32c 100755
--- a/scripts/runqemu-export-rootfs
+++ b/scripts/runqemu-export-rootfs
@@ -68,7 +68,7 @@ NFSPID=~/.runqemu-sdk/nfs$NFS_INSTANCE.pid
 MOUNTPID=~/.runqemu-sdk/mount$NFS_INSTANCE.pid
 
 PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
-PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/var/pseudo"
+PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/../pseudo_state/$(basename $NFS_EXPORT_DIR)"
 export PSEUDO_LOCALSTATEDIR
 
 if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk
index 4b52475..88fdf0d 100755
--- a/scripts/runqemu-extract-sdk
+++ b/scripts/runqemu-extract-sdk
@@ -73,15 +73,18 @@ if [ ! -d "$SDK_ROOTFS_DIR" ]; then
 	mkdir -p "$SDK_ROOTFS_DIR"
 fi
 
-if [ -e "$SDK_ROOTFS_DIR/var/pseudo" ]; then
-	echo "Error: $SDK_ROOTFS_DIR/var/pseudo already exists!"
-	echo "Please delete the entire rootfs tree manually if this is really what you want"
+pseudo_state_dir="$SDK_ROOTFS_DIR/../pseudo_state_$(basename "$SDK_ROOTFS_DIR")"
+
+if [ -e "$pseudo_state_dir" ]; then
+	echo "Error: $pseudo_state_dir already exists!"
+	echo "Please delete the rootfs tree and pseudo directory manually"
+        echo "if this is really what you want."
 	exit 1
 fi
 
-mkdir -p "$SDK_ROOTFS_DIR/var/pseudo"
-touch "$SDK_ROOTFS_DIR/var/pseudo/pseudo.pid"
-PSEUDO_LOCALSTATEDIR="$SDK_ROOTFS_DIR/var/pseudo"
+mkdir -p "$pseudo_state_dir"
+touch "$pseudo_state_dir/pseudo.pid"
+PSEUDO_LOCALSTATEDIR="$pseudo_state_dir
 export PSEUDO_LOCALSTATEDIR
 
 echo "Extracting rootfs tarball using pseudo..."
-- 
1.7.0.4




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

* Re: [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs
  2012-08-23  1:47 ` [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs Peter Seebach
@ 2012-08-24  7:31   ` Scott Garman
  2012-08-24 19:55   ` Peter Seebach
  1 sibling, 0 replies; 4+ messages in thread
From: Scott Garman @ 2012-08-24  7:31 UTC (permalink / raw)
  To: openembedded-core

On 08/22/2012 06:47 PM, Peter Seebach wrote:
> In a few places, we have scripts which use <rootfs>/var/pseudo for
> the pseudo state directory controlling a given filesystem. This
> seems possibly risky because it means that stuff running under
> qemu or whatnot could wipe out the data being used to handle that
> rootfs. Move this to:
>    <rootfs>/../pseudo_state_$(basename $rootfs)
> to avoid problems.
>
> This also solves at least one case (not directly hit by yocto's
> tree) wherein you could end up trying to remove a rootfs while
> pseudo was using a database inside that rootfs, and thus the
> remove would fail.
>
> Signed-off-by: Peter Seebach <peter.seebach@windriver.com>

I haven't tested this, but it appears to address the concerns I raised 
earlier.

With Jessica on vacation, could anyone else on the SDK team try this out 
and verify it with some sanity tests? e.g, boot some images using unfs 
and from an installed sdk.

Scott

> ---
>   .../installer/adt-installer/scripts/extract_rootfs |    8 ++++----
>   scripts/runqemu-export-rootfs                      |    2 +-
>   scripts/runqemu-extract-sdk                        |   15 +++++++++------
>   3 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
> index 62dc170..fee463c 100755
> --- a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
> +++ b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
> @@ -28,7 +28,6 @@ extract_rootfs()
>     native_sysroot=$3
>     target_sysroot=$2
>     PSEUDO_COMMAND="$native_sysroot/usr/bin/pseudo"
> -  PSEUDO_OPTS="-P $natvie_sysroot/usr"
>     TAR_OPTS="-xjf"
>     PSEUDO_OPTS="-P $native_sysroot/usr"
>
> @@ -46,9 +45,10 @@ extract_rootfs()
>       mkdir -p "$target_sysroot"
>     fi
>
> -  mkdir -p "$target_sysroot/var/pseudo"
> -  touch "$target_sysroot/var/pseudo/pseudo.pid"
> -  PSEUDO_LOCALSTATEDIR="$target_sysroot/var/pseudo"
> +  pseudo_state_dir="$target_sysroot/../pseudo_state_$(basename "$target_sysroot")"
> +  mkdir -p "$pseudo_state_dir"
> +  touch "$pseudo_state_dir/pseudo.pid"
> +  PSEUDO_LOCALSTATEDIR="$pseudo_state_dir"
>     export PSEUDO_LOCALSTATEDIR
>
>     echo_info "Extracting rootfs: $1, using pseudo..."
> diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
> index f8213ba..0e0d32c 100755
> --- a/scripts/runqemu-export-rootfs
> +++ b/scripts/runqemu-export-rootfs
> @@ -68,7 +68,7 @@ NFSPID=~/.runqemu-sdk/nfs$NFS_INSTANCE.pid
>   MOUNTPID=~/.runqemu-sdk/mount$NFS_INSTANCE.pid
>
>   PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
> -PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/var/pseudo"
> +PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/../pseudo_state/$(basename $NFS_EXPORT_DIR)"
>   export PSEUDO_LOCALSTATEDIR
>
>   if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
> diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk
> index 4b52475..88fdf0d 100755
> --- a/scripts/runqemu-extract-sdk
> +++ b/scripts/runqemu-extract-sdk
> @@ -73,15 +73,18 @@ if [ ! -d "$SDK_ROOTFS_DIR" ]; then
>   	mkdir -p "$SDK_ROOTFS_DIR"
>   fi
>
> -if [ -e "$SDK_ROOTFS_DIR/var/pseudo" ]; then
> -	echo "Error: $SDK_ROOTFS_DIR/var/pseudo already exists!"
> -	echo "Please delete the entire rootfs tree manually if this is really what you want"
> +pseudo_state_dir="$SDK_ROOTFS_DIR/../pseudo_state_$(basename "$SDK_ROOTFS_DIR")"
> +
> +if [ -e "$pseudo_state_dir" ]; then
> +	echo "Error: $pseudo_state_dir already exists!"
> +	echo "Please delete the rootfs tree and pseudo directory manually"
> +        echo "if this is really what you want."
>   	exit 1
>   fi
>
> -mkdir -p "$SDK_ROOTFS_DIR/var/pseudo"
> -touch "$SDK_ROOTFS_DIR/var/pseudo/pseudo.pid"
> -PSEUDO_LOCALSTATEDIR="$SDK_ROOTFS_DIR/var/pseudo"
> +mkdir -p "$pseudo_state_dir"
> +touch "$pseudo_state_dir/pseudo.pid"
> +PSEUDO_LOCALSTATEDIR="$pseudo_state_dir
>   export PSEUDO_LOCALSTATEDIR
>
>   echo "Extracting rootfs tarball using pseudo..."
>


-- 
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center



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

* Re: [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs
  2012-08-23  1:47 ` [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs Peter Seebach
  2012-08-24  7:31   ` Scott Garman
@ 2012-08-24 19:55   ` Peter Seebach
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Seebach @ 2012-08-24 19:55 UTC (permalink / raw)
  To: Peter Seebach; +Cc: openembedded-core

On Wed, 22 Aug 2012 20:47:23 -0500
Peter Seebach <peter.seebach@windriver.com> wrote:

> +PSEUDO_LOCALSTATEDIR="$pseudo_state_dir

... This quote really IS missing. Something must have gone horribly
wrong with my merge attempt.

-s
-- 
Listen, get this.  Nobody with a good compiler needs to be justified.



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

end of thread, other threads:[~2012-08-24 20:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-23  1:47 [PATCH 0/1] v2: Move pseudo directory out of its filesystem Peter Seebach
2012-08-23  1:47 ` [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs Peter Seebach
2012-08-24  7:31   ` Scott Garman
2012-08-24 19:55   ` Peter Seebach

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