5

From rpm's man page:

   --pipe CMD
          Pipes the output of rpm to the command CMD.

Why was this added? Why would you use it instead piping via the shell itself?

2

1 Answer 1

1

That option would not be useful when rpm is called from a shell.

But when called from some other program it would simplify passing non-static arguments to rpm if those arguments are constructed from some form of user input (provided the calling program is written in a language that does not forcefully call a shell to execute other programs anyway):

  • When not using a shell, the calling program would need to setup the pipe by itself and call and wait for rpm and CMD separately.
  • When using a shell like sh -c ´rpm Argument1 Argument2 ...´ | CMD, it needs an additional level of quoting around arguments to prevent them from being split into words or interpreted by the shell if those arguments could contain spaces or shell metacharacters:
    If some argument to rpm is user input to the calling program, it could possibly be Tom and Alice´s dog and the programmer would have to translate that to Tom\ and\ Alice\´s\ dog when building the argument list for the shell. (And any arguments to CMD would have to be quoted the same way.)
    This is slower, error prone and may raise security concerns.
  • When using the --pipe option, the calling program needs none of these.
    (But any arguments to CMD would have to be quoted like before because CMD is interpreted by a shell which is called from rpm because CMD is a single word from a single argument to rpm.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.