Menu

#331 PBcR: hard-coded absolute path to `time`

overlapper
open
nobody
bug (1) path (1)
5
2015-12-02
2015-11-25
George Sun
No

Hi,

I am writing to report a bug found in PBcR file, where the time command has been hard-coded at /usr/bin/time. However, in our case (and I think some other systems as well), we may not install the utility command time at /usr/bin. I am suggesting to replace them as the command time directly as shown in the attached file.

George

2 Attachments

Discussion

  • Sergey Koren

    Sergey Koren - 2015-11-25

    Normally when using bash /usr/bin/time != time as /usr/bin/time is GNU Time and time is the shell built-in version which reports less information. You could update it to use /usr/bin/env time or just remove the timing command altogether since the timing is optional and not required to run the command.

     
  • George Sun

    George Sun - 2015-11-25

    Yeah, I replaced them by "time" in the patch I provided. Are you suggesting me to use "/usr/bin/env time" instead?

    I feel like this might become common if this software is being installed on clusters. In my case, I am working at a computation center and one of our users requested to install this software. The installation worked only on some of our compute nodes, since we didn't build all GNU commands into our cores to save the unnecessary overheads. The command "time" is installed remotely in our case.

    Such kind of errors are actually hard to debug. It took us a while to duplicate and figure out the issue. That's why I am creating this ticket to suggest a fix to avoid confusions by other system administrators.

     
  • Sergey Koren

    Sergey Koren - 2015-11-25

    I meant that running "time" would report different results so it wouldn't keep the same functionality the code has now under bash. For example:
    % time pwd > dev/null
    real 0m0.000s
    user 0m0.000s
    sys 0m0.000s

    % /usr/bin/time pwd > dev/null
    0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 2112maxresident)k
    0inputs+0outputs (0major+158minor)pagefaults 0swaps

    % /usr/bin/env time pwd > /dev/null
    0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 2080maxresident)k
    0inputs+0outputs (0major+155minor)pagefaults 0swaps

    So that is why I was suggesting using /usr/bin/env time so it would find the GNU time utility if it is available and fall-back to a built-in version if it is not.

     

    Last edit: Sergey Koren 2015-11-25
  • George Sun

    George Sun - 2015-11-25

    I see. I will try it after the holiday.

     
  • George Sun

    George Sun - 2015-12-02

    Yeah, I agree. /usr/bin/env time should be better. Would you consider to change the source to resolve such kind of issues?

     

Log in to post a comment.

MongoDB Logo MongoDB