• [gentoo-user] Piping "emerge -a" to some other command

    From Dr Rainer Woitok@21:1/5 to All on Thu Feb 24 12:50:01 2022
    Greetings,

    since the output of "emerge -a" might be long, and since on a stock con-
    sole you cannot scroll, I had the idea of piping it into "tee", and in
    case I'm unsure just to say "No" to the question of whether or not I
    would like to merge these packages and then to inspect the "emerge" out-
    put more closely using an editor.

    Sadly, however, this works only partly:

    $ sudo emerge -1a acct-group/abrt | tee
    Password:

    These are the packages that would be merged, in order:

    Calculating dependencies ... done!
    [ebuild N ] acct-group/abrt-0-r1

    And that's it, however long you're going to wait here. You can then
    blindly say "No", and "tee" will continue its output:

    Would you like to merge these packages? [Yes/No]
    Quitting.

    $

    Replacing "tee" with "more" does not change anything, so most likely the culprit is "emerge" itself, which seems to instantly block standard out-
    put after it has sent its question there.

    So, is this a bug or a feature?

    Sincerely,
    Rainer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich Freeman@21:1/5 to rainer.woitok@gmail.com on Thu Feb 24 13:20:01 2022
    On Thu, Feb 24, 2022 at 6:47 AM Dr Rainer Woitok
    <rainer.woitok@gmail.com> wrote:

    since the output of "emerge -a" might be long, and since on a stock con-
    sole you cannot scroll, I had the idea of piping it into "tee", and in
    case I'm unsure just to say "No" to the question of whether or not I would like to merge these packages and then to inspect the "emerge" out-
    put more closely using an editor.

    Wouldn't it be more appropriate to use -p in this case, which will
    require no input?

    I haven't dug into the man page, but I'm sure there are also options
    that are more intended to make the output more suitable for
    parsing/etc.

    --
    Rich

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Covici@21:1/5 to Rich Freeman on Thu Feb 24 16:10:01 2022
    On Thu, 24 Feb 2022 07:10:10 -0500,
    Rich Freeman wrote:

    On Thu, Feb 24, 2022 at 6:47 AM Dr Rainer Woitok
    <rainer.woitok@gmail.com> wrote:

    since the output of "emerge -a" might be long, and since on a stock con- sole you cannot scroll, I had the idea of piping it into "tee", and in case I'm unsure just to say "No" to the question of whether or not I would like to merge these packages and then to inspect the "emerge" out- put more closely using an editor.

    Wouldn't it be more appropriate to use -p in this case, which will
    require no input?

    I haven't dug into the man page, but I'm sure there are also options
    that are more intended to make the output more suitable for
    parsing/etc.


    I use script for that purpose and it works great, the output is
    complete and I can just say no and its all there.

    --
    Your life is like a penny. You're going to lose it. The question is:
    How do
    you spend it?

    John Covici wb2una
    covici@ccs.covici.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dr Rainer Woitok@21:1/5 to you on Fri Feb 25 10:10:01 2022
    Rich,

    On Thursday, 2022-02-24 07:10:10 -0500, you wrote:

    ...
    Wouldn't it be more appropriate to use -p in this case, which will
    require no input?

    Running "emerge -p ..." followed by "emerge ..." without "-p" would run
    the dependency analysis twice for EVERY package update. Using a single "emerge -a" call will run the dependency analysis only once for almost
    each package update. The option to say "N" and further inspect the "em-
    erge" output using an editor is meant as sort of a safety belt which is
    not intended to be used on a daily basis.

    I haven't dug into the man page, but I'm sure there are also options
    that are more intended to make the output more suitable for
    parsing/etc.

    A quick search in the "emerge" manual page for "pars" and "pip" did not
    turn up anything I considered relevant. Can anyone give more hints?

    Sincerely,
    Rainer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arve Barsnes@21:1/5 to Dr Rainer Woitok on Fri Feb 25 10:20:01 2022
    On Fri, 25 Feb 2022 at 10:00, Dr Rainer Woitok <rainer.woitok@gmail.com> wrote:
    A quick search in the "emerge" manual page for "pars" and "pip" did not
    turn up anything I considered relevant. Can anyone give more hints?

    I'm guessing any proposed solution would fail when what you want to
    capture has an interactive component like this.

    My solution would rather be to run your emerge commands in a place
    that would give you the scroll-back that you lack now, such as in a
    screen session. It feels like something like a screen session would be potentially beneficial in more ways as well, such as being able to do
    this remotely.

    Regards,
    Arve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dr Rainer Woitok@21:1/5 to you on Fri Feb 25 11:30:01 2022
    John,

    On Thursday, 2022-02-24 09:59:50 -0500, you wrote:

    ...
    I use script for that purpose and it works great, the output is
    complete and I can just say no and its all there.

    Nice idea. However, I'd like to keep things as simple as possible, be-
    cause an important usecase for me is installing a new or fixing an ex-
    isting system after booting from a USB stick. The "script" binary is in package "sys-apps/util-linux" which belongs to "@system", so it SHOULD
    be on my USB stick. Like "cmp" and "diff" from package "sys-apps/diff-
    utils" which belong to "@system" too, but which were NOT on my USB stick
    when I used it to install my current system about three years ago, or at
    least they were not in "PATH" (I then didn't frantically need these, so
    I didn't really search for them).

    I do not know what "nano" (the only editor then available) will do with
    all the control characters in the "script" output file, and "scriptre-
    play" doesn't seem to offer any interactive control. I do have a "gawk"
    based shell function which turns a "script" output file into a normal
    text file containing command log + standard output + standard error sans
    any control characters, but this will not yet be available in that situ-
    ation.

    So I'm still preferring "tee" here which definitely WAS on my USB stick.

    Sincerely,
    Rainer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dr Rainer Woitok@21:1/5 to you on Fri Feb 25 12:40:01 2022
    Arve,

    On Friday, 2022-02-25 10:15:18 +0100, you wrote:

    ...
    I'm guessing any proposed solution would fail when what you want to
    capture has an interactive component like this.

    I think "fail" is the wrong word here. My own scripts send such quest-
    ions to the same device they retrieve the answer from ("/dev/tty" in my
    case). So both, question and answer would be missing from the log file produced by "tee", but they would appear on the screen, which seems more important to me.

    But you are right in that it would at least be difficult to have them in
    both places.

    Sincerely,
    Rainer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Neil Bothwick@21:1/5 to Dr Rainer Woitok on Fri Feb 25 14:10:01 2022
    On Fri, 25 Feb 2022 11:26:34 +0100, Dr Rainer Woitok wrote:

    Nice idea. However, I'd like to keep things as simple as possible, be- cause an important usecase for me is installing a new or fixing an ex- isting system after booting from a USB stick. The "script" binary is in package "sys-apps/util-linux" which belongs to "@system", so it SHOULD
    be on my USB stick. Like "cmp" and "diff" from package "sys-apps/diff- utils" which belong to "@system" too, but which were NOT on my USB stick
    when I used it to install my current system about three years ago, or at least they were not in "PATH" (I then didn't frantically need these, so
    I didn't really search for them).

    Use a different live distro, one that includes all you need - such as
    System Rescue. I think Arve's suggestion of using screen (or tmux) is the simplest effective solution. I routinely run emerge -a @world in a tmux session, and scrolling back though long update lists is easy.


    --
    Neil Bothwick

    I spilled Spot remover on my dog. Now he's gone.

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCAAdFiEE8k9T/rX16EJxEKG692eFu0QSMJgFAmIY07kACgkQ92eFu0QS MJg4Iw/9FeljrX+i4ZWOfIXZuq2MafZkl89rDENElCM2g/kGIP7HSHRRBxFyQ6Qj IqHRM5NWTL33sU6ymu/GJF61FzHfkYHKPTsTGHkgitkmtx6BBQpi7Jcy5G9VJMyA TKjQEI5cIRwZ86ThQljfTcKTlbIw43HW3kXYHolp9qTm61fNnlXFoRlQC4D1IVW+ n2hlI1OfSpZCPcE3GZ3DnhrqWPy7JHAERRKUqpqbKg/55dJb4AbLWbJVDY4nBmD2 UhXS+TKXb6Us6boewHTqSoEfzhDqlCP2h8tYTpxbrSLi/qGAehpCSl8wlHjLP8Iy 0MC7yBYapvOC4B7vm00xHhZbVBCM6Of763Kh6YdTyQuK0l8grjuV/9SG8TdZJtXQ xF1g1cEeOttS1jp1LVrm0zOWGijmVbf3WC4Pq/DrFYGswhugzVIqGxbKTXjUmHzm bB376ZfvFyqWiyiH4INWDQQqIJ/Q2JNgk3N58B4s4HccA2R1jN0oVZ/NUBYDiWTj T5pZQFvV6kyCr63nhSzRrql2cUjAZux5qu2b3HaXBhaxhlOs9KjO6NweYtkYMiYA UarzsvTbmsWzTxe+45mk1D/B9FhvRQzbTEiGbPf7qgg5vlUjMSQ5zj1b9REPaFR3 Lb5OdFcAkWPYcKULH5VAVww0V4PLjfRnfI9sGK3ncscnxqWflBg=
    =wJrt
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)