summaryrefslogtreecommitdiffstats
path: root/pki/base/silent/src/http/HTTPClient.java
diff options
context:
space:
mode:
authorjdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2010-11-19 20:36:54 +0000
committerjdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2010-11-19 20:36:54 +0000
commit391e47d2b0006d49395b1906a1f6f469e874dfa2 (patch)
tree59a089453c70709b2bc354cf45818b96e97c43da /pki/base/silent/src/http/HTTPClient.java
parent3295970b2f978951e235bb237912f0f7497b687d (diff)
Reimplement copy_directory, remove_directory
The copy_directory function was losing critical information. It called out to the shell to recursively copy the contents of one directory to another. But this meant we lost track of the files and directories actually being copied, we couldn't log them nor add them to the installation manifest. Now the copy_directory function builds a list of files in the src directory and iteratively copies each file calling into our copy_file function which records the operation and checks for errors. The remove_directory function was an unapologetic sledge hammer, it simply nuked entire trees. Now the function is more sensible, by default it removed one empty directory, or optionally recursively removes all directory contents. Both functions previously had serious implementation mistakes. Both were implemented by calling out to a UNIX shell and invoking a shell command via the Perl backtick operator. The fundamental problems with this were: * UNIX shell commands only work on UNIX * Not all UNIX shell commands are identical * The error detection stragegy was completly broken. It executed the shell command via the backtick operator which returns the stdout of the command and discards stderr. The function would then test to see if the length of stdout was zero to determine if there was an error. If there was no stdout it assumed no errors occurred. This is completely wrong. To test if an error occurs with a shell command one needs to examine the exit status of the command which is impossible to do with the Perl backtick operator. If one wants to test the exit status of a shell command in Perl you must utilize the subprocess features of Perl. The reimplementation eschews the non-portable use of UNIX shell commands in favor of the portable Perl extensions for operating on filesystem directories. git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1538 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/silent/src/http/HTTPClient.java')
0 files changed, 0 insertions, 0 deletions