Skip to content
This repository has been archived by the owner on May 31, 2018. It is now read-only.

Arguments with spaces not forwarded to pacman correctly #490

Closed
chaoren opened this issue Apr 19, 2016 · 4 comments
Closed

Arguments with spaces not forwarded to pacman correctly #490

chaoren opened this issue Apr 19, 2016 · 4 comments

Comments

@chaoren
Copy link
Contributor

chaoren commented Apr 19, 2016

E.g.,

$ touch "foo bar"
$ pacaur -Qo foo\ bar
error: failed to find 'foo' in PATH: No such file or directory
error: failed to find 'bar' in PATH: No such file or directory
$ pacman -Qo foo\ bar
error: No package owns foo bar

You should quote everything so that arguments get forwarded exactly as is. E.g.,

"$pacmanbin" "${pacmanarg[@]}" "${pacopts[@]}" "${pkgs[@]}"

instead of

$pacmanbin ${pacmanarg[@]} ${pacopts[@]} ${pkgs[@]}

Upon further inspection, there's another problem with your script. Places like this:

[[ -z "${repopkgs[@]}" ]]

should be like this instead:

[[ -z "${repopkgs[*]}" ]]

FYI,

foo=(a "b c")
"${foo[@]}" # expands to "a" "b c"
"${foo[*]}" # expands to "a b c"
 ${foo[@]}  # expands to "a" "b" "c"
 ${foo[*]}  # expands to "a" "b" "c"
@rmarquis
Copy link
Owner

Thanks, this is related to #460. I am aware of that issue and never fixed it since nobody should use silly space in filenames. So the question remains: Why would you use space in filename? What is your usercase?

@rmarquis rmarquis added this to the 4.6.x - maintenance milestone Apr 19, 2016
@ismaelgv
Copy link
Contributor

ismaelgv commented Apr 19, 2016

Well, even if there is no usercase, pacaur shouldn't break pacman usability.

Edit: I agree with you that spaces in the filenames are just stupid.

@chaoren
Copy link
Contributor Author

chaoren commented Apr 19, 2016

There are packages that contain files with spaces in their names. I have no control over this. Doing pacaur -Qo on these files to find out which package owns them should just work.

I personally don't have strong opinions on whether file names should contain spaces, and that's irrelevant, since these files do exist, and your script chokes on them.

@rmarquis
Copy link
Owner

rmarquis commented Jun 11, 2016

Quick fixed in 44fa07a. Rest of shellcheck conformity issue will be tracked in #460, closing here.

@rmarquis rmarquis added bug and removed todo labels Jun 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants