Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plog fails when uploading multiple files to BKG #186

Closed
wehimwich opened this issue Oct 5, 2022 · 2 comments
Closed

plog fails when uploading multiple files to BKG #186

wehimwich opened this issue Oct 5, 2022 · 2 comments

Comments

@wehimwich
Copy link
Member

wehimwich commented Oct 5, 2022

Kiah at Kokee reports:

$ plog -c BKG v22276
INFO: plog: found /usr2/log/v22276k2_full.log
INFO: plog: Creating reduced log file...
56.9MiB 0:00:02 [  26MiB/s] [===============================================================================================>] 100%
INFO: plog: queued /tmp/v22276k2.log
INFO: plog: Compressing log file...
56.9MiB 0:00:04 [12.3MiB/s] [===============================================================================================>] 100%
INFO: plog: queued /tmp/v22276k2_full.log.bz2
INFO: plog: uploading to BKG
curl: (3) <url> malformed
drwxr-xr-x    2 ftp      ftp             6 Jul 28  2021 combination
lrwxrwxrwx    1 ftp      ftp             2 Jul 28  2021 ivsincoming -> ./
drwxr-xr-x    2 ftp      ftp             6 Feb 01  2022 vgosdb_usno
@wehimwich
Copy link
Member Author

wehimwich commented Oct 5, 2022

The bash code requires a complicated nesting of quotes and braces to turn a list of multiple files passed in as arguments to a function, e.g., /tmp/v22276k2.log /tmp/v22276k2_full.log.bz2, into a brace enclosed, comma delimited string, e.g., {/tmp/v22276k2.log,/tmp/v22276k2_full.log.bz2} for the -T option of curl. This is further complicated by the use of eval to support the "dry run" feature of plog. The following change seems to work, but maybe there is a simpler solution.

     local F=($@) #Turn into an array so IFS is used in expansion
     local IFS=","
-    eval $DRY curl $SSL_REQUIRED -n $CURL_NETRC_FILE_OPTION -T "{${F[*]}}" "ftp://$URL/"
+    local G=$(echo "{${F[*]}}")
+    local IFS=" "
+    eval $DRY curl $SSL_REQUIRED -n $CURL_NETRC_FILE_OPTION -T \"$G\" "ftp://$URL/"

@wehimwich
Copy link
Member Author

A little simpler:

-    eval $DRY curl $SSL_REQUIRED -n $CURL_NETRC_FILE_OPTION -T "{${F[*]}}" "ftp://$URL/"
+    local G="{${F[*]}}"
+    local IFS=" "
+    eval $DRY curl $SSL_REQUIRED -n $CURL_NETRC_FILE_OPTION -T '$G' "ftp://$URL/"

wehimwich added a commit that referenced this issue Oct 14, 2022
wehimwich added a commit that referenced this issue Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant