On Mon, Oct 10, 2011 at 10:54:08AM -0000, [email protected] wrote: > Author: jsuchome > Date: Mon Oct 10 12:54:07 2011 > New Revision: 66356 > > URL: http://svn.opensuse.org/viewcvs/yast?rev=66356&view=rev > URL: > http://svn.opensuse.org/viewcvs/yast/trunk/snapper/src/Snapper.ycp?rev=66356&r1=66355&r2=66356&view=diff > @@ -131,7 +131,8 @@ > > // check mode and ownerships > out = (map) SCR::Execute (.target.bash_output, > - sformat ("ls -ld %1 %2 | cut -f 1,3,4 -d ' '", file1, file2)); > + sformat ("ls -ld -- '%1' '%2' | cut -f 1,3,4 -d ' '", > + String::Quote (file1), String::Quote (file2))); > list<string> parts = splitstring (out["stdout"]:""," \n"); > > if (parts[0]:"" != parts[3]:"") > @@ -284,8 +285,12 @@ > */ > integer GetFileMode (string file) { > > - map out = (map) SCR::Execute (.target.bash_output, "/bin/stat > --printf=%a " + file); > - return tointeger (out["stdout"]:"755"); > + map out = (map) SCR::Execute (.target.bash_output, > + sformat ("/bin/stat --printf=%%a '%1'", String::Quote (file))); > + string mode = out["stdout"]:""; > + if (mode == nil || mode == "") > + return 644; > + return tointeger (mode); > } > > /**
To both of the above: .target.stat ... oh wait, it doesn't include the file mode. Does that mean we are stuck with ugly workarounds like this forever? You can ask for a straightforward extension of that API or even implement it yourself. It's actually easy. And BTW, GetFileMode should return a string, because it is later used as a string. 0644 != 644. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
pgptmHcO52I5L.pgp
Description: PGP signature
