Skip to content

-vb duplicates progress bar output #53

Open

Description

@CarstenGrohmann

Hi,

if you run vmtouch -vb the progress bar lines are added twice to the output file. It would be great if the lines just occur once.

Steps to reproduce:

# fgrep -r "foobarHURZ" /usr/

# find /usr/ -type f | vmtouch -vb - > vmtouch.out

# less vmtouch.out
/usr/lib/libxcb-xv.so.0.0.0
^M[OOOOOOOO] 8/8^M[OOOOOOOO] 8/8
/usr/lib/libXext.so.6.4.0
^M[OOOOOOOOOOOOOOOOOOO] 19/19^M[OOOOOOOOOOOOOOOOOOO] 19/19
/usr/lib/libX11-xcb.so.1.0.0
^M[OO] 2/2^M[OO] 2/2
[...]

# cat vmtouch.out | tr '\r' '\n'
/usr/lib/libxcb-xv.so.0.0.0

[OOOOOOOO] 8/8
[OOOOOOOO] 8/8
/usr/lib/libXext.so.6.4.0

[OOOOOOOOOOOOOOOOOOO] 19/19
[OOOOOOOOOOOOOOOOOOO] 19/19
/usr/lib/libX11-xcb.so.1.0.0
[...]

Regards,
Carstem

Activity

  1. hoytech commented on Jun 6, 2017

    @hoytech
    Owner

    Hi,

    The reason you're seeing two is that it tries to show an interactive progress bar while touching, by printing "\r" to go back to the beginning of the line and overwriting with a new progress bar. I believe it does this at the beginning and the end of processing each file, which is why you're seeing 2 even though you're not touching (just displaying).

    I agree this looks like a bug. I'll think about the best way to solve this and update this ticket when I do.

    In the meantime, you can eliminate the excess lines with the following:

    cat vmtouch.out | perl -pe 's/^.*\r//'

    Thanks for the report!

  2. pfee commented on Apr 14, 2022

    @pfee

    I've encountered the same issue, reproduced with:

    $ vmtouch -v /usr/bin/ls | cat -v
    /usr/bin/ls
    ^M[OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO] 33/33^M[OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO] 33/33
    
               Files: 1
         Directories: 0
      Resident Pages: 33/33  132K/132K  100%
             Elapsed: 0.000152 seconds
    

    My use case is to regularly display vmtouch output using the watch utility.

    $ watch -n 1 vmtouch -v growing_file.bin
    

    Having output repeated twice is undesirable. Perhaps vmtouch could have a flag to disable the interactive progress bar and its use of \r.

  3. pfee commented on Apr 15, 2022

    @pfee

    Having looked at the code, the carriage return characters can be eliminated for the case where -v is used on the command line without -t. The changes are available in pull request #97.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions