Giter VIP home page Giter VIP logo

Comments (15)

actionless avatar actionless commented on June 20, 2024 1

that's weird, but since i can't reproduce the problem in arch - i'm closing this one

from pikaur.

actionless avatar actionless commented on June 20, 2024

what the output of sudo --preserve-env=EDITOR bash -c 'echo $EDITOR' ?

also install latest pikaur-git and upload the log again please

from pikaur.

gheritarish avatar gheritarish commented on June 20, 2024

Well, there we have it:

❯ sudo --preserve-env=EDITOR bash -c 'echo $EDITOR'
nano

(as a note: without specifying the EDITOR in preserve-env, the result is nvim, as expected)

And for the logs:

:: debug: install_info_fetcher: got AUR pkgs install info: []
=> pacman --color=always --query --upgrades --quiet
=> pacman --color=always --sync lib32-libgudev --print-format %r/%n
:: debug: install_cli: self.install_info.all_install_info_containers=([<RepoInstallInfo "lib32-libgudev" 237-2 -> 238-1>], [], [], [], [], [], [], [])
:: debug: news: print
:: debug: news: loading date from /home/telmar/.cache/pikaur/last_seen_news.dat
:: debug: news: data: Sun, 18 Jun 2023 09:14:37 +0000, parsed: 2023-06-18 09:14:37+00:00
:: debug: news: Arch News Date: 2023-06-18 09:14:37+00:00, Last-seen date: 2023-06-18 09:14:37+00:00

:: Repository package will be installed:
 lib32-libgudev                        237-2                -> 238-1

:: debug: prompt: Gonna get input from user...
:: debug: FileLock: Acquiring /tmp/pikaur_prompt_502584.lock...
:: debug: FileLock: Acquired /tmp/pikaur_prompt_502584.lock
:: debug: prompt_nolock: Restoring TTY...
:: debug: prompt_nolock: Using standard input reader...
:: Proceed with installation? [Y/n]
:: [v]iew package details   [m]anually select packages
>> m
:: debug: FileLock: Releasing /tmp/pikaur_prompt_502584.lock
:: debug: FileLock: Released /tmp/pikaur_prompt_502584.lock
:: debug: prompt: Got answer: 'm'

:: debug: prompt: Found editor: nano
=> sudo --user=#1000 --preserve-env=EDITOR -- nano /tmp/tmp5m5azstn

So that explains the "bug". Thanks for the help!

Update: I fixed it by specifying to preserve the EDITOR in the sudoers file, but since I didn't needed that before, I'll let you choose if you want to chose the issue or not.

from pikaur.

actionless avatar actionless commented on June 20, 2024

weird - did you previously altered your sudoers file?

i have default config file from arch linux and it being preserved, so in the first case i'm seeing output of EDITOR set in the current user, not in root

from pikaur.

gheritarish avatar gheritarish commented on June 20, 2024

No, I never edited it before.

I use endeavour, not pure arch, but it should be globally the same file I think

from pikaur.

jonathan-strange avatar jonathan-strange commented on June 20, 2024

Same issue here, using Manjaro.

> echo $EDITOR
vim                                                                                                                                                                              
> sudo --preserve-env=EDITOR bash -c 'echo $EDITOR' 
usr/bin/nano

My fix is add the following to /etc/sudoers (remember to use visudo)

Defaults env_keep += "EDITOR VISUAL"

from pikaur.

notEvil avatar notEvil commented on June 20, 2024

For me, the culprit was /etc/environment where Cnchi (legacy installer of Antergos) added EDITOR=/usr/bin/nano. And since pikaur is using a non-interactive shell, that was used instead of user (interactive) configuration like ~/.bashrc.

from pikaur.

actionless avatar actionless commented on June 20, 2024

i wonder, if it would be better then to spawn commands with some different sudo flags?

from pikaur.

notEvil avatar notEvil commented on June 20, 2024

Running the editor as user would be ideal imo. With sudo -E you get the same experience as if you were the user, but with potential for file ownership issues (e.g. Neovim; new files are owned by root and typically not writable by the user after that)

from pikaur.

actionless avatar actionless commented on June 20, 2024

no, preserving all env variables (-E) wouldn't work in this case:

your user
      |
      v
sudo pikaur
      |-----------|
      v           v
pacman    sudo -u your_user EDITOR_CMD

because in that case all your env variables would end up in pacman, while it should be running with root's env vars

from pikaur.

actionless avatar actionless commented on June 20, 2024

Running the editor as user would be ideal imo

and this is a good point - i've just realized that during build and during PKGBUILD review editor command is not changing the user properly, i'll fix this

from pikaur.

notEvil avatar notEvil commented on June 20, 2024

I see. Maybe sudo -i then? It doesn't preserve the original environment though.

from pikaur.

actionless avatar actionless commented on June 20, 2024

please don't do any suggestions, if you don't know for sure

from pikaur.

notEvil avatar notEvil commented on June 20, 2024

I read the man page and from my experience it looks like a reasonable solution. But I haven't read the source code of pikaur from start to finish nor did I try every possible user configuration to make sure this is definitely the way to go. Maybe I will, but probably not.

My first suggestion was under the assumption that pikaur is run as user and elevates privileges only for pacman, which is not unreasonable to assume.

from pikaur.

actionless avatar actionless commented on June 20, 2024

My first suggestion was under the assumption that pikaur is run as user and elevates privileges only for pacman, which is not unreasonable to assume.

that's described in readme, reading is usually more effective than asuming ;)

from pikaur.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.