From: Gregory Heytings <gregory@heytings.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: mvar.40k@gmail.com, larsi@gnus.org, mcenturion@fing.edu.uy,
arthur.miller@live.com, 47058@debbugs.gnu.org
Subject: bug#47058: 28.0.50; Dired Z: insert-directory: Reading directory: No such file or directory, CrossLine_linux_x86
Date: Tue, 21 Sep 2021 19:19:52 +0000 [thread overview]
Message-ID: <052fb8a67e886712c3e6@heytings.org> (raw)
In-Reply-To: <834kadydjo.fsf@gnu.org>
>> Would it not be easier to unconditionally untar the contents in a
>> temporary directory, and to either move its contents to the current
>> directory if it contains only one entry, or to rename it to a directory
>> based on the tar file name when it contains more than one entry?
>
> Easier in what sense?
>
In the sense of "DWIM".
>> Something like:
>>
>> TMP=$(mktemp -d ./XXXXXXXX)
>> tar -C $TMP -x -z -f $FILE
>> if (($(ls $TMP | wc -l) == 1))
>> then
>> mv $TMP/* .
>> rmdir $TMP
>> else
>> mv $TMP $(basename $FILE .tar.gz)
>> fi
>
> Wouldn't that remove the files that are in the directory but not in the
> archive?
>
No, it does what I explained above:
If all files in the tar file are under one directory (e.g.
emacs-27.2.tar.gz whose files are all in a emacs-27.2 directory), the
files will be in that directory.
If on the contrary the tar file is "broken" and its files are under
multiple directories or not in a directory (say foobar.tar.gz with three
files "/foo", "/bar" and "/baz"), the files will be put in a directory
"foobar".
next prev parent reply other threads:[~2021-09-21 19:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 20:26 bug#47058: 28.0.50; Dired Z: insert-directory: Reading directory: No such file or directory, CrossLine_linux_x86 Jean Louis
2021-08-31 21:33 ` Marco Centurion
2021-08-31 22:12 ` Arthur Miller
2021-09-01 13:59 ` Marco Centurion - URI
2021-09-01 16:06 ` Arthur Miller
2021-09-20 22:12 ` Michalis V.
2021-09-21 4:32 ` Lars Ingebrigtsen
2021-09-21 8:24 ` Eli Zaretskii
2021-09-21 9:18 ` Michalis V.
2021-09-21 9:32 ` Eli Zaretskii
2021-09-21 17:10 ` Lars Ingebrigtsen
[not found] ` <83a6k5yfrb.fsf@gnu.org>
2021-09-21 17:58 ` Lars Ingebrigtsen
2021-09-21 18:38 ` Gregory Heytings
2021-09-21 18:43 ` Eli Zaretskii
2021-09-21 19:19 ` Gregory Heytings [this message]
2021-09-21 20:11 ` Michalis V.
2021-09-21 20:48 ` Gregory Heytings
2021-09-22 5:40 ` Eli Zaretskii
2021-09-22 7:15 ` Gregory Heytings
2021-09-22 7:54 ` Eli Zaretskii
2021-09-22 8:07 ` Gregory Heytings
2021-09-21 17:07 ` Lars Ingebrigtsen
2021-09-21 20:43 ` Michalis V.
2021-09-22 6:00 ` Eli Zaretskii
2021-09-21 8:25 ` Michael Albinus
2021-09-21 9:24 ` Michalis V.
2021-09-21 12:06 ` Michael Albinus
2022-03-11 8:29 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=052fb8a67e886712c3e6@heytings.org \
--to=gregory@heytings.org \
--cc=47058@debbugs.gnu.org \
--cc=arthur.miller@live.com \
--cc=eliz@gnu.org \
--cc=larsi@gnus.org \
--cc=mcenturion@fing.edu.uy \
--cc=mvar.40k@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).