Timeline for Why does copying from a script screw with my files?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 14, 2013 at 9:49 | vote | accept | Oliver N. | ||
| Oct 11, 2013 at 23:43 | comment | added | slm♦ | @Gilles - yeah this wasn't well thought out, just something off the cuff. | |
| Oct 11, 2013 at 23:43 | history | edited | slm♦ | CC BY-SA 3.0 |
added 381 characters in body
|
| Oct 11, 2013 at 22:56 | comment | added | Gilles 'SO- stop being evil' |
@OliverN. I haven't analyzed your script in detail to figure out what causes this problem, but the eval raises a red flag. It WILL completely break for certain file names. If someone is allowed to choose a file name under _opt/ke, they are writing a code snippet that your script executes. eval is a delicate tool to be used sparingly and you are using it wrong.
|
|
| Oct 11, 2013 at 15:22 | comment | added | slm♦ |
@OliverN. - I do a fair amount of scripting using this type of pattern and I've not needed to use eval like this. Only if I have variables nested inside of the array that I want to get expanded prior, do I use an eval.
|
|
| Oct 11, 2013 at 15:08 | comment | added | Oliver N. | Ok scrap that, I am seriously confused here. I retested this and now both commands work, regardless the order. The only thing I might have done is deleting the target directory instead of just cleaning its content. Sorry for the confusion, but unless the cp behaviour changes by the hour I have no explanation why it is working now. :/ | |
| Oct 11, 2013 at 14:50 | comment | added | Oliver N. |
I don't think this has anything to do with the eval. After the suggestions from the comment above I did some testing. If I run the expanded cp command (cp -fr _opt/ke/cache _opt/ke/conf _opt/ke/modules _opt/ke/scripts _opt/ke/t /home/opt/ke) by hand, the files are corrupted, too. But when running it in another order (like cp -fr _opt/ke/cache _opt/ke/t _opt/ke/conf _opt/ke/modules _opt/ke/scripts /home/opt/ke ) everything is fine again. So I assume the short directory name "t" is causing this (a bug maybe?).
|
|
| Oct 11, 2013 at 14:31 | history | answered | slm♦ | CC BY-SA 3.0 |