Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mv: target ~/.cache/fisher/github.com/... is not a directory #557

Closed
tobia opened this issue Nov 6, 2019 · 29 comments
Closed

mv: target ~/.cache/fisher/github.com/... is not a directory #557

tobia opened this issue Nov 6, 2019 · 29 comments

Comments

@tobia
Copy link

tobia commented Nov 6, 2019

I cannot seem to be able to install new packages using any 3.2.x version of fisher.

Here is an example using 3.2.0, but the same error occurs with any later version including master:

▶ curl -sSo ~/.config/fish/functions/fisher.fish https://raw.githubusercontent.com/jorgebucaran/fisher/3.2.0/fisher.fish
▶ source ~/.config/fish/functions/fisher.fish
▶ rm -r ~/.config/fisher/ ~/.cache/fisher/ ~/.config/fish/fishfile
▶ fisher add reitzig/sdkman-for-fish@v1.3.0
created empty fishfile in ~/.config/fish/fishfile
fetching https://codeload.github.com/reitzig/sdkman-for-fish/tar.gz/v1.3.0
mv: target '/home/tobia/.cache/fisher/github.com/reitzig/sdkman-for-fish' is not a directory
cp: cannot stat '/home/tobia/.cache/fisher/github.com/reitzig/sdkman-for-fish': No such file or directory
done in 0.50s

Here is the same command with 3.1.1, which works properly:

▶ curl -sSo ~/.config/fish/functions/fisher.fish https://raw.githubusercontent.com/jorgebucaran/fisher/3.1.1/fisher.fish
▶ source ~/.config/fish/functions/fisher.fish
▶ rm -r ~/.config/fisher/ ~/.cache/fisher/ ~/.config/fish/fishfile
▶ fisher add reitzig/sdkman-for-fish@v1.3.0
created empty fishfile in ~/.config/fish/fishfile
fetching https://codeload.github.com/reitzig/sdkman-for-fish/tar.gz/v1.3.0
linking ~/.config/fish/functions/sdk.fish
linking ~/.config/fish/completions/sdk.fish
linking ~/.config/fish/conf.d/sdk.fish
added 1 package in 0.61s

I'm using fish 2.7.1, installed from the default apt repository of Ubuntu 18.04

@jorgebucaran
Copy link
Owner

@tobia Did you upgrade from 3.1.1 to 3.2.0 while using fish 2.7.1 just now? I'd like to know if the problem was fish 2.7.1 or a breaking change that I might have sneaked into the code.

@tobia
Copy link
Author

tobia commented Nov 6, 2019

Yes, I'm using fish 2.7.1 and I tried several versions of fisher, resetting all caches in between, as you can see from the logs I posted.

Either I have something weird in my system, or there was a breaking change in 3.20.

@jorgebucaran
Copy link
Owner

@tobia Can you try removing fisher completely and trying again?

@tobia
Copy link
Author

tobia commented Nov 6, 2019

I've been removing ~/.config/fisher/, ~/.cache/fisher/, ~/.config/fish/fishfile, and replacing ~/.config/fish/functions/fisher.fish.

What else should I remove?

@jorgebucaran
Copy link
Owner

I mean just run fisher self-uninstall. But it seems that this might not the problem, but something in your system, but I have no idea what! 🤔

@jorgebucaran
Copy link
Owner

@tobia Any luck?

@MaSven
Copy link

MaSven commented May 4, 2020

I have the same problem with fish version 3.1.0. I tried it with fisher self-uninstall and after that installed it again but no luck

@MaSven
Copy link

MaSven commented May 4, 2020

After debuggin the script, i found out, that at line 306 the pkgname is missing.
So the command
command mkdir -p $fisher_config/$pkg $fisher_cache/(command dirname $pkg)
Does create

~/.config/fisher/github.com/reitzig/sdkman-for-fish
and
~/.cache/fisher/github.com/reitzig
So the second one is missing the subdir sdkman-for-fish

@MaSven
Copy link

MaSven commented May 4, 2020

Ok no this is not the problem the same happens with
fisher add jethrokuan/z

@jorgebucaran
Copy link
Owner

@MaSven @tobia Can you repro in 3.2.11?

@jorgebucaran
Copy link
Owner

@MaSven #557 (comment)

Maybe dirname is not available in your system? What are you using?

@MaSven
Copy link

MaSven commented May 23, 2020

I tried to recreate it in docker but can't.
I'am using opensuse TW. I tryed to recreate it with this docker container https://hub.docker.com/r/opensuse/tumbleweed. I will try the new version.

@MaSven
Copy link

MaSven commented May 23, 2020

Does not work with new version. I get the same error.

@tobia
Copy link
Author

tobia commented May 23, 2020

Same here. I'm using a freshly installed Ubuntu 20.04 (although I did bring my home folder over from my previous installation) with the provided Fish 3.1.0 and I get the same error as before:

$ curl -sSo ~/.config/fish/functions/fisher.fish https://raw.githubusercontent.com/jorgebucaran/fisher/3.2.11/fisher.fish
$ source ~/.config/fish/functions/fisher.fish
$ rm -r ~/.config/fisher/ ~/.cache/fisher/ ~/.config/fish/fishfile
$ fisher add reitzig/sdkman-for-fish@v1.3.0
created new fishfile in ~/.config/fish/fishfile
fetching https://codeload.github.com/reitzig/sdkman-for-fish/tar.gz/v1.3.0
mv: target '/home/tobia/.cache/fisher/github.com/reitzig/sdkman-for-fish' is not a directory
cp: cannot stat '/home/tobia/.cache/fisher/github.com/reitzig/sdkman-for-fish': No such file or directory
done in 0.46s

The 4 lines of code I'm running to test it, as I did in the OP, are: 1. downloading the specific version of fisher; 2. sourcing it into the running shell; 3. removing all fisher-related configurations and caches; 4. trying to add a package.

@jorgebucaran
Copy link
Owner

@tobia @MaSven What's the content of your XDG_CONFIG_HOME and XDG_CACHE_HOME env variables?

@MaSven
Copy link

MaSven commented May 24, 2020

These two environment variables don't exists.

❰sven❙~❱✔≻ echo $XDG_CONFIG_HOME

❰sven❙~❱✔≻ echo $XDG_CACHE_HOME

❰sven❙~❱✔≻ 

@jorgebucaran
Copy link
Owner

@MaSven Does your mkdir support the -p flag (to create intermediate directories as required)?

@MaSven
Copy link

MaSven commented May 24, 2020

Yes it does

❰sven❙~❱✘≻ mkdir --help
Aufruf: mkdir [OPTION]... VERZEICHNIS...
Erzeugen der/des Verzeichnisse(s), wenn sie noch nicht existieren.

Erforderliche Argumente für lange Optionen sind auch für kurze erforderlich.
  -m, --mode=MODUS  Zugriffsrechte setzen (wie bei chmod), nicht a=rwx − umask
  -p, --parents     kein Fehler, wenn vorhanden; übergeordnete
                      Verzeichnisse erzeugen, wenn notwendig
  -v, --verbose     für jedes angelegte Verzeichnis eine Meldung ausgeben
  -Z                   SELinux-Sicherheitskontext jedes erzeugten Verzeichnisses
                         auf den Standardtyp setzen
      --context[=KTXT] wie -Z, oder, wenn angegeben den SELinux- oder SMACK-
                         Kontext auf KTXT setzen
      --help     diese Hilfe anzeigen und beenden
      --version  Versionsinformation anzeigen und beenden

Onlinehilfe für GNU coreutils: <https://www.gnu.org/software/coreutils/>
Melden Sie Übersetzungsfehler für %s an <translation-team-de@lists.sourceforge.net>
Die vollständige Dokumentation ist hier: <https://www.gnu.org/software/coreutils/mkdir>
oder auch lokal mittels „info '(coreutils) mkdir invocation'“
❰sven❙~❱✔≻ 

@jorgebucaran
Copy link
Owner

jorgebucaran commented May 24, 2020

@tobia #557 (comment)

Here you described the steps to reproduce the bug by installing reitzig/sdkman-for-fish@v1.3.0, but could you do the same for a package known to work?

So, repeat your steps, but instead of reitzig/sdkman-for-fish@v1.3.0 try.

$ fisher add jorgebucaran/fish-spark

What happens?


@MaSven #557 (comment)

Thank you for attempting to debug the script, but I don't think that's the issue, as our goal is just to create the parent directory tree. Copying the package there happens later.

@MaSven What about your cp command? Does it support -f and -R?

@MaSven
Copy link

MaSven commented May 24, 2020

❰sven❙~❱✘≻ fisher add jorgebucaran/fish-spark
fetching https://codeload.github.com/jorgebucaran/fish-spark/tar.gz/master
linking ~/.config/fish/functions/spark.fish
added 1 package, removed 1 package in 0.56s

This worked.
cp command

❰sven❙~❱✔≻ cp --help                                                                                                                   
Aufruf: cp [OPTION]... [-T] QUELLE ZIEL                                                                                                
  oder: cp [OPTION]... QUELLE... VERZEICHNIS                                                                                           
  oder: cp [OPTION]... -t VERZEICHNIS QUELLE...                                                                                        
Kopieren von QUELLE nach ZIEL, oder mehreren QUELLE(n) in VERZEICHNIS      
                                                                                                                                       
Erforderliche Argumente für lange Optionen sind auch für kurze erforderlich.
  -a, --archive               genau wie -dpR --preserve=all                                                                            
      --attributes-only       nicht die Dateidaten, sondern nur die Attribute
                                kopieren                                                                                               
      --backup[=KONTROLLE]    eine Sicherung existierender Zieldateien erzeugen                                                        
  -b                          wie --backup, akzeptiert aber kein Argument
      --copy-contents         wenn rekursiv, Inhalt von Spezialdateien kopieren                                                        
  -d                          genau wie --no-dereference --preserve=links                                                              
  -f, --force                 wenn existierende Zieldatei nicht geöffnet werden
                                kann, löschen und erneut versuchen (wird bei    
                                Verwendung der Option -n ignoriert) 
  -i, --interactive           vor einem Überschreiben nachfragen (überstimmt                                                           
                                eine vorangehende Option -n)                                                                           
  -H                          symbolischen Verknüpfungen, die auf der         
                                Kommandozeile als QUELLE angegeben sind,                                                               
                                folgen                                                                                                 
  -l, --link                  Dateien verknüpfen, statt sie zu kopieren 
  -L, --dereference           symbolischen Verknüpfungen in QUELLE immer folgen    
  -n, --no-clobber            keine existierenden Dateien überschreiben             
                                (übersteuert eine vorangehende Option -i)                                                              
  -P, --no-dereference        symbolischen Verknüpfungen in QUELLE nie folgen
  -p                          genau wie --preserve=mode,ownership,timestamps
      --preserve[=ATTR_LIST]  angegebene Datei‐Attribute erhalten wenn möglich
                                (Voreinstellung: mode,ownership,timestamps;
                                weitere Attribute: context, links, xattr, all)
      --no-preserve=ATTR_LIST  Angegebene Attribute nicht erhalten
      --parents                kompletten Quell‐Pfad an VERZEICHNIS anhängen
  -R, -r, --recursive         Verzeichnisse rekursiv kopieren
      --reflink[=WANN]        Klon/CoW Kopien kontrollieren. Siehe unten
      --remove-destination    jede Zieldatei vor dem Versuch, sie zu öffnen,
                                löschen (im Gegensatz zu --force)
      --sparse=WANN           Erstellung von Dateien mit Löchern (s. u.) steuern
      --strip-trailing-slashes  Schrägstriche vom Ende jedes QUELLE‐Arguments
                                entfernen
  -s, --symbolic-link         symbolische Verknüpfungen erzeugen anstatt
                                zu kopieren
  -S, --suffix=ENDUNG         Standard-Sicherungs‐Dateiendung ändern
  -t, --target-directory=VERZ  alle QUELLE‐Argumente in VERZ kopieren
  -T, --no-target-directory   ZIEL als normale Datei behandeln
  -u, --update                nur kopieren, wenn die QUELL‐Datei neuer ist
                                als die Zieldatei oder die Zieldatei nicht
                                existiert
  -v, --verbose               durchgeführte Tätigkeiten erklären
  -x, --one-file-system       in diesem Dateisystem verbleiben
  -Z                           den SELinux-Sicherheitskontext der Zieldatei
                                 auf den Standardtyp setzen
      --context[=KTXT]         Wie -Z, oder, wenn KTXT angegeben wurde, den
                                 SELinux- oder SMACK-Sicherheitskontext auf
                                 KTXT setzen
      --help     diese Hilfe anzeigen und beenden
      --version  Versionsinformation anzeigen und beenden

@jorgebucaran
Copy link
Owner

jorgebucaran commented May 24, 2020

@MaSven fisher add jorgebucaran/fish-spark

If that worked, could you clarify what didn't work? I thought you couldn't install any packages at all? Or is the issue you can't install reitzig/sdkman-for-fish only?

@MaSven
Copy link

MaSven commented May 24, 2020

I think I misread the first comment. But for me it is only happening with sdkman-for-fish.

@jorgebucaran
Copy link
Owner

jorgebucaran commented May 24, 2020

Thank you for clarifying that, @MaSven. When fisher installs a package, it'll also attempt to activate it, that means sourcing all the files inside functions, completions and the conf.d directory.

Maybe there's something in reitzig/sdkman-for-fish/blob/master/conf.d/sdk.fish causing Fisher to fail.

Are you able to install reitzig/sdkman-for-fish by simply dropping {functions,conf.d}/sdk.fish inside your functions and conf.d directory respectively?

@MaSven
Copy link

MaSven commented May 24, 2020 via email

@jorgebucaran
Copy link
Owner

jorgebucaran commented May 24, 2020

Okay, I was worried about installing this package, but I decided to give it a go after checking the source code (which seemed fine):

fetching https://codeload.github.com/reitzig/sdkman-for-fish/tar.gz/master
linking ~/.config/fish/functions/sdk.fish
linking ~/.config/fish/completions/sdk.fish
linking ~/.config/fish/conf.d/sdk.fish
added 1 package in 0.17s

...and it installed without problems. I'm afraid that without a reliable way to reproduce this error, there's not much I can do.

@reitzig
Copy link

reitzig commented Jun 18, 2020

So, repeat your steps, but instead of reitzig/sdkman-for-fish@v1.3.0 try.

$ fisher add jorgebucaran/fish-spark

What happens?

One difference I note is that spark has only a single top-level file, while sdkman-for-fish has completions/conf.d/functions.
@tobia / @MaSven , can you reproduce with another package including multiple folders?


This line seems fragile to me:

if command curl $curl_opts -Ss -w \"\" $url 2>&1 | command tar -xzf- -C $fisher_config/$pkg 2>/dev/null

We don't have pipefail (?) so it relies on tar exiting with an error whatever comes its way, if there's any issue.
Which it doesn't always do, apparently.

So, @tobia and @MaSven, what versions of tar do you fly? Can you check whether e.g.

command curl -Ss -w "" https://github.com/foo/bar | command tar -xzf- -C foo
echo $status

is?

@jorgebucaran , would it make sense to capture error output, and print it in case of an issue? I'll note that curl does not always return a failure status code, e.g. in case of a 404, unless flag -f is given but we never get an output here of a download failing.

What I think might be going on here is the download fails for some reason, and an old version of tar exits with 0 despite not receiving tar-y input.

Then we enter the cp/mv orgy despite not having downloaded anything.


I will note that I do not understand this sequence of commands:

rm -Rf $fisher_cache/$pkg
mv -f $fisher_config/$pkg/* $fisher_cache/$pkg

If the glob matches exactly one file, this will work; otherwise, I read "copy A and B into C which doesn't exist".
Is it possible that the tarball sometimes containers more than that one folder you're expecting (maybe depending on user agent?), or some tar versions write something, or that old files are around there?

I tried to reproduce along these lines, but didn't manage to. 🤷

@MaSven
Copy link

MaSven commented Jul 12, 2020

I tried the same with https://github.com/rafaelrinaldi/pure and this seems to work normally. My tar version is 1.32 GNU. Maybe i need an example with completions.

@jorgebucaran
Copy link
Owner

Hey @MaSven @tobia @reitzig! So, is this solved or is it still happening?

@reitzig
Copy link

reitzig commented Jul 27, 2020

@tobia will have to answer that; I've never been able to reproduce. :/

I'm happy to help and/or fix sdkman-for-fish -- if I get any hint as to what may be the problem.

Repository owner locked and limited conversation to collaborators Jul 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants