Message ID | 20170205173434.31894-1-wei.liu2@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Wei Liu writes ("[OSSTEST PATCH] standalone-reset: use mkdir -p"): ... > ensure_dir () { > if test -d "$1"; then return; fi > - mkdir "$1" > + mkdir -p "$1" This deliberately doesn't do this. Otherwise wrong (or partially missing) configuration can create strangely-named directories. What missing parent directory did you want it to create ? Ian.
On Mon, Feb 06, 2017 at 11:49:23AM +0000, Ian Jackson wrote: > Wei Liu writes ("[OSSTEST PATCH] standalone-reset: use mkdir -p"): > ... > > ensure_dir () { > > if test -d "$1"; then return; fi > > - mkdir "$1" > > + mkdir -p "$1" > > This deliberately doesn't do this. Otherwise wrong (or partially > missing) configuration can create strangely-named directories. > > What missing parent directory did you want it to create ? > /tmp/wei/osstest/ > Ian.
Wei Liu writes ("Re: [OSSTEST PATCH] standalone-reset: use mkdir -p"): > On Mon, Feb 06, 2017 at 11:49:23AM +0000, Ian Jackson wrote: > > Wei Liu writes ("[OSSTEST PATCH] standalone-reset: use mkdir -p"): > > ... > > > ensure_dir () { > > > if test -d "$1"; then return; fi > > > - mkdir "$1" > > > + mkdir -p "$1" > > > > This deliberately doesn't do this. Otherwise wrong (or partially > > missing) configuration can create strangely-named directories. > > > > What missing parent directory did you want it to create ? > > /tmp/wei/osstest/ I guess I mean, which configuration option ? What was your configuration ? Did /tmp/wei exist ? Ian.
On Mon, Feb 06, 2017 at 03:13:17PM +0000, Ian Jackson wrote: > Wei Liu writes ("Re: [OSSTEST PATCH] standalone-reset: use mkdir -p"): > > On Mon, Feb 06, 2017 at 11:49:23AM +0000, Ian Jackson wrote: > > > Wei Liu writes ("[OSSTEST PATCH] standalone-reset: use mkdir -p"): > > > ... > > > > ensure_dir () { > > > > if test -d "$1"; then return; fi > > > > - mkdir "$1" > > > > + mkdir -p "$1" > > > > > > This deliberately doesn't do this. Otherwise wrong (or partially > > > missing) configuration can create strangely-named directories. > > > > > > What missing parent directory did you want it to create ? > > > > /tmp/wei/osstest/ > > I guess I mean, which configuration option ? What was your > configuration ? tftptmp=`getconfig TftpTmpDir` ensure_dir "$tftp$tftptmp" And $tftp is set to /tmp/ in my standalone config. > Did /tmp/wei exist ? No. > > Ian.
Wei Liu writes ("Re: [OSSTEST PATCH] standalone-reset: use mkdir -p"): > tftptmp=`getconfig TftpTmpDir` > ensure_dir "$tftp$tftptmp" OK. I'm afraid I think if TftpTmpDir's parent does not exist, osstest should not create it automatically. > And $tftp is set to /tmp/ in my standalone config. As an aside: this habit of using /tmp as a personal playground is a really bad one. It may be fine on your single-user workstation, but if it slips into any code or config which you ship to anyone else, it is a security problem. You should probably create a ~/tmp. Ian.
diff --git a/standalone-reset b/standalone-reset index 69a3226..d3a8f0d 100755 --- a/standalone-reset +++ b/standalone-reset @@ -49,7 +49,7 @@ fi ensure_dir () { if test -d "$1"; then return; fi - mkdir "$1" + mkdir -p "$1" } ensure_key () {
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- standalone-reset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)