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

xdg-utils: add missing dependencies #95675

Merged
merged 1 commit into from Nov 16, 2020
Merged

Conversation

erikarvstedt
Copy link
Member

@erikarvstedt erikarvstedt commented Aug 17, 2020

  • Add coreutils to PATH, because the xdg scripts use other not yet provided coreutils like head.
    This makes the custom 'cut' and 'sort' functions obsolete.
    Remove double quotes around $out because $out contains no Bash field separators.
  • Replace all instances of 'which' with 'type -P'.
    The previous sed command only replaced instances with a leading space.

Reproduce

firefox=$(nix-build --no-out-link '<nixpkgs>' -A firefox)
xdgUtils=$(nix-build --no-out-link '<nixpkgs>' -A xdg_utils)
env -i XDG_DATA_DIRS=$firefox/share PATH=$firefox/bin $xdgUtils/bin/xdg-mime query default x-scheme-handler/http
## Output before this patch:
# /nix/store/.../bin/xdg-mime: line 1031: head: command not found
# /nix/store/.../bin/xdg-mime: line 1031: head: command not found
# /nix/store/.../bin/xdg-mime: line 1031: head: command not found
# /nix/store/.../bin/xdg-mime: line 1031: head: command not found
# /nix/store/.../bin/xdg-mime: line 947: basename: command not found
## Output after this patch:
# firefox.desktop

@erikarvstedt erikarvstedt force-pushed the fix-sdg-utils branch 2 times, most recently from 80eb2c5 to 3565781 Compare August 17, 2020 11:01
- Add coreutils to PATH, because the xdg scripts use other not yet
  provided coreutils like head.
  This makes the custom 'cut' and 'sort' functions obsolete.
  Remove double quotes around $out because $out contains no Bash field separators.
- Replace all instances of 'which' with 'type -P'.
  The previous sed command only replaced instances with a leading space.
@erikarvstedt
Copy link
Member Author

/marvin opt-in
/status needs_reviewer

@marvin-mk2 marvin-mk2 bot added the marvin label Sep 1, 2020
@marvin-mk2
Copy link

marvin-mk2 bot commented Sep 1, 2020

Hi! I'm an experimental bot. My goal is to guide this PR through its stages, hopefully ending with a merge. You can read up on the usage here.

xset() { ${xset}/bin/xset "$@"; }\
perl() { PERL5LIB=${perlPath} ${perlPackages.perl}/bin/perl "$@"; }\
mimetype() { ${perlPackages.FileMimeInfo}/bin/mimetype "$@"; }\
PATH=$PATH:'"$out"'/bin\
PATH=$PATH:'$out'/bin:${coreutils}/bin\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this was previously not done to avoid polluting $PATH (#25511 (comment)).

I think your argument that xdg-utils scripts will expect other coreutils commands, like head and basename, to be present is reasonable.

Another approach might be to process those xdg scripts to point to the specific tool implementations they expect (e.g. busybox or coreutils), but given that this derivation already pulls in coreutils it seems reasonable to just leverage those.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least the following executables are used from coreutils: head, wc, tr, touch, test, tail. I think it is fine to pollute the $PATH with all those binaries or we wrap here for days.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having xdg-utils contaminate the environment is bad because it can be confusing. Imagine opening a nix file in a text editor using xdg-open and then testing it in a terminal opened from the text editor. Now, arguably, users will likely have coreutils installed so this is more important when adding other programs to PATH, or when exporting other environment variables but we should still keep it in mind. Ideally we would use something like @abathur’s resholved.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resholved isn't in a production-ready state yet and it's also unvavailable in nixpkgs.
Do you propose to wait until resholved is released? This could take months, judging its current progress.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't read context here so I'm commenting generally:

I don't want you to be stuck waiting for resholve to land in Nixpkgs (and hate me if it takes a bit).

But, if resholve does solve a problem here without needing any new features, I don't think it would take "months" and I'm open to discussing timelines/priorities.

It shouldn't be too hard to add resholve temporarily to test it out. It has a good core of functionality, and it works for a living in my own profile and in Graham's. I even considered it ready for inclusion earlier this year, but the override API's grown into a bit of a haphazard kitchen sink that I've decided to fix before calling an initial release.

It is basically at the top of my "priority" list, but some "urgent" projects are taking all of its sunlight.

@marvin-mk2
Copy link

marvin-mk2 bot commented Oct 22, 2020

Reminder: Please review!

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the needs_reviewer queue in one day.

xset() { ${xset}/bin/xset "$@"; }\
perl() { PERL5LIB=${perlPath} ${perlPackages.perl}/bin/perl "$@"; }\
mimetype() { ${perlPackages.FileMimeInfo}/bin/mimetype "$@"; }\
PATH=$PATH:'"$out"'/bin\
PATH=$PATH:'$out'/bin:${coreutils}/bin\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least the following executables are used from coreutils: head, wc, tr, touch, test, tail. I think it is fine to pollute the $PATH with all those binaries or we wrap here for days.

@marvin-mk2
Copy link

marvin-mk2 bot commented Oct 26, 2020

Reminder: Please review!

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the needs_reviewer queue in one day.

1 similar comment
@marvin-mk2
Copy link

marvin-mk2 bot commented Oct 29, 2020

Reminder: Please review!

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the needs_reviewer queue in one day.

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 95675 run on x86_64-darwin 1

2 packages marked as broken and skipped:
  • far2l
  • fff
2 packages failed to build:
  • eureka-editor
  • manim
4 packages built:
  • alacritty
  • gitAndTools.git-open
  • mkvtoolnix-cli
  • xdg_utils

@marvin-mk2
Copy link

marvin-mk2 bot commented Nov 2, 2020

Reminder: Please review!

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the needs_reviewer queue in one day.

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Nov 4, 2020

Result of nixpkgs-review pr 95675 run on x86_64-darwin 1

2 packages marked as broken and skipped:
  • far2l
  • fff
2 packages failed to build:
  • eureka-editor
  • manim
4 packages built:
  • alacritty
  • gitAndTools.git-open
  • mkvtoolnix-cli
  • xdg_utils
src/main.cc:55:10: fatal error: 'OSXCalls.h' file not found
#include "OSXCalls.h"
         ^~~~~~~~~~~~
5 warnings and 1 error generated.
make: *** [Makefile:120: obj_linux/main.o] Error 1
make: *** Waiting for unfinished jobs....

@marvin-mk2
Copy link

marvin-mk2 bot commented Nov 7, 2020

Reminder: Please review!

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the needs_reviewer queue in one day.

2 similar comments
@marvin-mk2
Copy link

marvin-mk2 bot commented Nov 10, 2020

Reminder: Please review!

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the needs_reviewer queue in one day.

@marvin-mk2
Copy link

marvin-mk2 bot commented Nov 14, 2020

Reminder: Please review!

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the needs_reviewer queue in one day.

@Mic92 Mic92 merged commit d092541 into NixOS:master Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants