rmarquis / pacaur

[unmaintained] An AUR helper that minimizes user interaction
https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144
ISC License
796 stars 113 forks source link

User config: error "#!/bin/bash: there is no such file or directory" #768

Closed michaldybczak closed 6 years ago

michaldybczak commented 6 years ago

I'm just an average user, just mildly technical one. I'm using yarourt on daily basis because it came preinstalled with Manjaro and it's incredibly simple. However, it's not safe tool and from AUR helpers comparison, pacaur looks nice. However... it's not friendly to use. When I set it in Octopi as default way to mange AUR, it just broke the whole Octopi so I had to go back to yaourt. When I try to use it in terminal, I get "no editor variable is set" error. Really? Why isn't it ready for work after installing and why is it so difficult to make it work? Nano is most basic editor and fine choice for me but pacaur seems to be not set to work with it.

I copied config to ~/.config/pacaur but I have no idea how to set nano there. Your page is not comprehensible about that. Why even nano, a most basic editor is not an automatic fallback?

Anyway, I see in config this weird and confusing: editor="${VISUAL:-${EDITOR:-vi}}" Editing it in any way results in another error message "!/bin/bash: there is no such file or directory" or "there is no such command", etc. What should I do?

EDIT: Actually, setting editor="${VISUAL:-${EDITOR:-nano}}" works but I still get the info "#!/bin/bash: there is no such file or directory" no matter if first line is commented or not. If I delete everything and leave only editor part, I just get a vague "no such file or directory".

So basically problem is with this error message, setting editor as nano works.

nbars commented 6 years ago

If you just have a look at the man page:

Pacaur is targeted at advanced users who want some degree of automation for repetitive tasks.

So this tool might not be targeted for you. Anyway, the EDITOR environment variable is supposed to be set by you in ~/.profile or /etc/profile for example.

I can not reproduce the problem with the config file. Also, I do not know where you are getting the error message.

FYI: The expression editor="${VISUAL:-${EDITOR:-vi}}" you are referring to is called Parameter Substitution, and is a feature of bash.

michaldybczak commented 6 years ago

Thanks for the answer.

My ~/.profile contains only:

#
# ~/.profile
#
#

[[ "$XDG_CURRENT_DESKTOP" == "KDE" ]] || export QT_QPA_PLATFORMTHEME="qt5ct"

[[ -f ~/.extend.profile ]] && . ~/.extend.profile

When doing even simple pacaur -Sy, command itself works but I also get:

/home/username/.config/pacaur/config: line 1: #!/bin/bash: No such file or directory

When I set the editor, pacaur started to work well in Octopi.

My config is just a direct copy from default config with change to nano editor (but without that change it also complains on missing file or directory)"

Here is the config:

#!/bin/bash

#
# /etc/xdg/pacaur/config
#

# The following options are commented out with their default values listed.
# If you wish to use different values, uncomment and update the values.
# The Color and VerbosePkgLists options can be enabled in /etc/pacman.conf.
# The clone directory can be changed through the $AURDEST environment variable.
# The makepkg environment variables are also fully honored.
editor="${VISUAL:-${EDITOR:-nano}}"     # build files editor
#displaybuildfiles=diff                # display build files (none|diff|full)
#fallback=true                         # pacman fallback to the AUR
#silent=false                          # silence output
#sortby=popularity                     # sort method (name|votes|popularity)
#sortorder=descending                  # sort order (ascending|descending)
#sudoloop=true                         # prevent sudo timeout

As to pacaur being for advanced users... My experience is, advanced users tend to avoid any AUR helpers, while noobs like me love them, because they save us a headache, so despite that reservation, inexperienced users will be the main users of AUR helpers. Since AUR in itself presents opportunity for loads of issues, I understand that such reservation is just to make your life easier, because you don't have time to deal with incompetent users. That's a fair approach.

Yaourt is the most used AUR helper but it has serious cons and pacaur is the second in popularity so it will attract users who want to improve their safety and experience (as pacaur seems to be convenient tool with options that yarourt misses).

nbars commented 6 years ago

You can add export EDITOR=nano to your ~/.profile config file. This makes this variable available to all programs running on your machine. https://wiki.archlinux.org/index.php/environment_variables

The error message must be caused by an issue with your setup. What is the output of the following commands?

head -n 1 config | od -c
whereis bash
file /bin/bash

I am sure that everybody is using an AUR helper because it is just too time-consuming if you're trying to manage all packages dependencies and update manually. And this helper is targeting the advanced users of these. Also, in my opinion, Arch-Linux itself is targeting advanced (Linux) users.

michaldybczak commented 6 years ago
head: can't open 'config' to read: No such file or directory
0000000
whereis bash
bash: /usr/bin/bash /usr/lib/bash /etc/bash.bash_logout /etc/bash.bashrc /etc/bash /usr/include/bash /usr/share/man/man1/bash.1.gz /usr/share/info/bash.info.gz
file /bin/bash
/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d84479e2e37f7e805b5bc004597b378a127dbf3c, stripped

I disabled user pacaur config and then the "No such file or directory" error disappears. However, I get again "Editor variable is not set". Somehow I can't make this export EDITOR=nano in ~/.profile to work. Simply adding the export EDITOR=nano doesn't work. I tried to add such || and other signs but I just don't know the signs grammar to use it properly, I can only guess. Arch wiki articles seem to omit this part so I'm not sure what it really does.

As to Arch itself, it's a strange beast. Arch installation via Arch way is for advanced users, but once you add system installer and ready configs, Arch becomes easiest distro... when we neglect possible AUR complications (which happen surprisingly rare). So lot of not-true-way-Arch users have weak understanding of many technical details, yet they understand enough to run it successfully - we're getting off topic ;).

rmarquis commented 6 years ago

Closing the issue now, feel free to keep commenting.

michaldybczak commented 6 years ago

This topic gave me an idea: https://unix.stackexchange.com/questions/27054/bin-bash-no-such-file-or-directory

I copied the config with kwrite where BOM is set and it was mentioned it could create issues. So I deleted the user config and copied and modified it again with nano and voila! It works now without that pesky error message! So all is fine now.

Thanks :)