Dražen Kačar wrote:
Martin Paul wrote:
I've found an elegant workaround now - if $WGETRC or ~/.wgetrc exists, pca copies it to a temporary wgetrc file (mode 600) and appends the "header" options for the SOA data. Before running wget, $WGETRC is set to point at this temporary file, which is immediately removed after wget completes.

You might have a race condition here. It can be worked around safely, but
it's a pain.

You mean somebody modifying ~/.wgetrc between the copy to the tmp file and wget reading it on startup? I can accept that, I guess. The tmp file is prepared right before wget is spawned, not just once when pca starts. Plus, only the user, not a process, is writing ~/.wgetrc; even if I hit the race condition, the only effect is ignoring the changes to wgetrc for a single download.

The simpler workaround is to set WGETRC to /dev/stdin and
then just write existing .wgetrc and the additional options to wget's
stdin.

I like that, and wget seems to accept /dev/stdin in WGETRC. It does away with the race condition *and* saves me from creating a temporary file, but ..

> If that's simple enough in Perl.

.. when reading about bidirectional IPC communication with perl it seems as if there's no simple, standard and non-ugly solution.

Martin.

Reply via email to