Bugzilla – Bug 116365
save_y2logs saves in a different directory
Last modified: 2008-03-15 22:19:23 UTC
The command cd /root/save_logs save_y2logs save_y2logs.tar.gz fails to create the tar file in the current directory as specified, because it changes current directory to /var/log before opening the output file. The fix is simple. Also, the name of save_y2logs is badly chosen, when all I remember is that it had to do with yast, and type yast<tab>, I don't find the script.
An average user who can't interpret the script (especially the "cd /var/log") will never find the y2logs and think the script is totally broken. One more problem: "save_y2logs --help" creates a tgz file named --help :-/ I'll append a patch that fixes the two problems - tarball is now created in the current directory - --help is supported (to be honest, -anything shows the help ;-)
Created attachment 56559 [details] patch fixing the described problems in save_y2logs
Created attachment 64430 [details] new patch, additionally fixed quoting of $1 / $TARGET
save_y2logs is still buggy in 10.1 beta1. Please apply the patch I provided.
Unfortunately not fixed in beta8 :-( Stefan, is there a special reason why you don't apply the patch provided here? If yes, tell me, and I'll (try to ;-) offer a new one that matches your needs better.
That patch did not do what we need. It would always include the entire path of all files, which is a pain to use when unpacking that archive (you'd get a directory tree ./var/log/YaST2 every time, forcing you to "cd" into that entire subtree). I changed the script to do what we really want, at the same time adding support for .tar.bz2 archives as well (and additionally checking that one of .tgz, .tar.gz, .tar.bz2 is used).
Created attachment 76651 [details] save_y2logs with improvements mentioned
Created attachment 76653 [details] save_y2logs with improvements mentioned
Just tested the fixed/improved script - everything works as expected. (BTW: didn't know "tar --directory" yet ;-) Thanks for fixing this!
The script is buggy as in it doesn't use array variables for file lists, which is potentially fatal as the file lists are generated with ls. If there's interest I'll change it to using arrays. Closing as the original problem is fixed.