True. What I like about cp -aL is being specific about it's operation...no assumption.
On Sat, Jun 6, 2026 at 9:06 PM B. Watson <[email protected]> wrote: > > > > On Sat, 6 Jun 2026, fourtysixandtwo wrote: > > > "cp -aL" would also fix the problem...dereference the link. > > Just using cp (with no flags) generally would do the same. > > <root@xiphos:~># mkdir a > <root@xiphos:~># cd a > <root@xiphos:~/a># touch a > <root@xiphos:~/a># ln -s a b > <root@xiphos:~/a># ls -l > total 0 > -rw-r--r-- 1 root root 0 Jun 6 22:53 a > lrwxrwxrwx 1 root root 1 Jun 6 22:53 b -> a > <root@xiphos:~/a># cp b c > <root@xiphos:~/a># ls -l c > -rw-r--r-- 1 root root 0 Jun 6 22:54 c > > "c" ends up a regular file, not a symlink. > > <root@xiphos:~/a># cp -a b d > <root@xiphos:~/a># ls -l d > lrwxrwxrwx 1 root root 1 Jun 6 22:53 d -> a > > ...with "cp -a", the destination ends up being a symlink. > > The intent of using "cp -a" is to preserve the timestamp, I suppose. But > "cat $CWD/file > $PKG/path/file" doesn't preserve the timestamp either. > Six of one, half a dozen of the other. > > So the rule should be: do not use "cp -a" to copy files from $CWD into > $PKG. Not only does it risk creating broken symlinks, but your script > doesn't know for a fact that root is the owner of the files in $CWD, > and shouldn't make that assumption. > _______________________________________________ > SlackBuilds-users mailing list > [email protected] > https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users > Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/ > FAQ - https://slackbuilds.org/faq/ > -- _______________________________________________ SlackBuilds-users mailing list [email protected] https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/ FAQ - https://slackbuilds.org/faq/ _______________________________________________ SlackBuilds-users mailing list [email protected] https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/ FAQ - https://slackbuilds.org/faq/
