Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-122214

Progress bar not shown on console for StandardError=journal+console but not for StandardError=tty

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-10.1
    • systemd
    • None
    • None
    • None
    • rhel-systemd
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      What were you trying to do that didn't work?

      A systemd service doesn't show progress bar in the console

      What is the impact of this issue to you?

      Without the progress bar, users may be mislead to think there is something wrong or even reboot the machine by force.

      Please provide the package NVR for which the bug is seen:

      How reproducible is this bug?:

      always

      Steps to reproduce

      1.  Build a program /usr/sbin/progress that prints progress bar,
        #include <stdio.h>
        #include <unistd.h>
        
        int main() {
        int total_time = 10;
        
        for (int remaining = total_time; remaining >= 0; remaining--) {
            int elapsed = total_time - remaining;
            fprintf(stderr, "\rProgress: %2d%% | ETA: %2d sec ", (elapsed * 100) / total_time, remaining);
            fflush(stderr);
            sleep(1);
        }
        
        fprintf(stderr, "\nDone.\n");
        return 0;
        }
        
      2. Create a systemd service progress.service and start it
        [Unit]
        Description=Print Progress
        
        [Service]
        Type=oneshot
        ExecStart=/usr/sbin/progress
        StandardInput=null
        StandardOutput=syslog
        StandardError=journal+console
        KillMode=process
        

         

      Expected results

      The progress bar will be printed.

      Actual results

      Only a line "Progress 100%..." is printed when the program finishes.

      Notes

      1. Using StandardError=tty instead of StandardError=journal+console can make the progress bar printed.
      2. This issue is originally reported by IBM developer Sourabh Jain in upstream

              systemd-maint systemd maint mailing list
              coxu@redhat.com Coiby Xu
              systemd maint mailing list systemd maint mailing list
              Frantisek Sumsal Frantisek Sumsal
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: