You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note the following when using xargs:
Using xargs can always be slower if many files are passed, because the java process may have to be started several times.
When using xargs, parameters and environment variables together may only occupy a maximum of 4096 bytes in the worst case. The size of the environment of root is around 2000 bytes (depending on operating system and configuration).
A "medium" installation of Ubuntu Desktop has about 400000 files.
This would result in the following comparison:
with --stdin the java process is started exactly once.
without --stdinxargs starts the java process about 10000 times.
But this is of course only the worst case, which should occur rarely.
The actual values of the particular system are provided by xargs --show-limits.
But xargs has one advantage in any case:
The parameter -P allows to run several processes in parallel.
So e.g.:
... will start 8 processes scanning in parallel. Here -r prevents the process from being started without parameters and -n100 determines that 100 arguments are passed at a time.
Provided you have enough CPU, this could speed up the detector scan.
However, in such cases the tool parallel should be preferred, because it is much more flexible.
Regardless, I hope that my pull request #43 will be accepted.
changed the title [-]Read file to scan from stdin[/-][+]Read files to scan from stdin to use `find` for excluding of files, folders and mount points[/+]on Dec 19, 2021
Activity
find
for excluding of files, folders and mount points #43zhurkin commentedon Dec 17, 2021
The find on large volumes just freezes . It is better to make an explicit exception in the program
beckerr-rzht commentedon Dec 17, 2021
I don't know such problems with
find
, but I just want to scan files on all local filesystems only.For example I'm actually using this
find
options:beckerr-rzht commentedon Dec 18, 2021
The current precompiled version 2021.12.17 supporting
--stdin
is here:https://github.com/beckerr-rzht/log4j-detector/raw/master/log4j-detector-2021.12.17.jar
juergenhoetzel commentedon Dec 19, 2021
You can build and execute command lines from standard input using
xargs
:beckerr-rzht commentedon Dec 19, 2021
Note the following when using
xargs
:Using
xargs
can always be slower if many files are passed, because the java process may have to be started several times.When using
xargs
, parameters and environment variables together may only occupy a maximum of 4096 bytes in the worst case. The size of the environment ofroot
is around 2000 bytes (depending on operating system and configuration).A "medium" installation of Ubuntu Desktop has about 400000 files.
This would result in the following comparison:
--stdin
the java process is started exactly once.--stdin
xargs
starts the java process about 10000 times.But this is of course only the worst case, which should occur rarely.
The actual values of the particular system are provided by
xargs --show-limits
.But
xargs
has one advantage in any case:The parameter
-P
allows to run several processes in parallel.So e.g.:
... will start 8 processes scanning in parallel. Here
-r
prevents the process from being started without parameters and-n100
determines that 100 arguments are passed at a time.Provided you have enough CPU, this could speed up the detector scan.
However, in such cases the tool
parallel
should be preferred, because it is much more flexible.Regardless, I hope that my pull request #43 will be accepted.
[-]Read file to scan from stdin[/-][+]Read files to scan from stdin to use `find` for excluding of files, folders and mount points[/+]juliusmusseau commentedon Dec 20, 2021
I did this in my own way. See v2021.12.20 which adds a new --stdin flag.
find
for excluding of files, folders and mount points #75