<div dir="ltr">You could always use the -P option to force the use of absolute pathnames when creating the tar archive (you could always restore relative to the / path if you like too).</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 3 Oct 2023 at 15:11, Ronald Barnes <<a href="mailto:ron@ronaldbarnes.ca">ron@ronaldbarnes.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I'm having issues with `tar` that I don't understand.<br>
<br>
<br>
I'm trying to backup several files / folders of mailman resources, but <br>
am getting errors on *one* of them.<br>
<br>
(I hope the following formatting is legible.)<br>
<br>
<br>
The 2 sample files, which exist:<br>
<br>
# ls -l /etc/apache2/sites-available/mailman2.conf <br>
/lib/systemd/system/mailman.service<br>
-rw-r--r-- 1 root root 4793 2021-05-02 14:00 <br>
/etc/apache2/sites-available/mailman2.conf<br>
-rw-r--r-- 1 root root 401 2018-06-23 09:14 <br>
/lib/systemd/system/mailman.service<br>
<br>
<br>
The tar command changes directory to "/" then runs, so path names do not <br>
get leading "/" stripped and the associated message doesn't appear:<br>
<br>
# tar -v --directory=/ -pjcf /tmp/mailman-test.tar <br>
lib/systemd/system/mailman* etc/apache2/sites-available/mailman2.conf<br>
<br>
The error message:<br>
<br>
tar: lib/systemd/system/mailman*: Cannot stat: No such file or directory<br>
etc/apache2/sites-available/mailman2.conf<br>
tar: Exiting with failure status due to previous errors<br>
<br>
<br>
It worked on the apache file, not the systemd file.<br>
<br>
<br>
If I run it with a leading "/" on the systemd file, this is the output:<br>
<br>
# tar -v --directory=/ -pjcf /tmp/mailman-test.tar <br>
/lib/systemd/system/mailman* etc/apache2/sites-available/mailman2.conf<br>
tar: Removing leading `/' from member names<br>
/lib/systemd/system/mailman.service<br>
tar: Removing leading `/' from hard link targets<br>
etc/apache2/sites-available/mailman2.conf<br>
<br>
<br>
So... now it removes the leading "/" and archives the systemd unit file.<br>
<br>
<br>
What's going on?<br>
<br>
<br>
<br>
Thanks!<br>
<br>
rb<br>
<br>
_______________________________________________<br>
kwlug-disc mailing list<br>
To unsubscribe, send an email to <a href="mailto:kwlug-disc-leave@kwlug.org" target="_blank">kwlug-disc-leave@kwlug.org</a><br>
with the subject "unsubscribe", or email<br>
<a href="mailto:kwlug-disc-owner@kwlug.org" target="_blank">kwlug-disc-owner@kwlug.org</a> to contact a human being.<br>
</blockquote></div>