Variable truncation in bash breaks all addons since v23
Closed this issue · 3 comments
Is there already an issue for your problem?
- I have checked older issues, open and closed
NZBGet Version
v24.2-stable
Platform
Linux/Docker
Environment
Docker 64bit
Current Behavior
Somewhere between:
a bug was introduced that as far as I can tell causes all user defined variable names in bash addons to truncate the first character
If you roll between v22 and v23 you can see this work and fail.
Expected Behavior
ENV should match script variables
Steps To Reproduce
Install this sample addon
#!/bin/bash
# post-processing script to test for ENV truncation
################################################################################
### NZBGET POST-PROCESSING SCRIPT ###
# We expect VAR name and VAR contents to match
################################################################################
### OPTIONS ###
# HELLO
hello=hello
# GOODBYE
goodbye=goodbye
### NZBGET POST-PROCESSING SCRIPT ###
################################################################################
echo "NZBPO_HELLO: $NZBPO_HELLO"
echo "NZBPO_ELLO: $NZBPO_ELLO"
echo "NZBPO_GOODBYE: $NZBPO_GOODBYE"
echo "NZBPO_OODBYE: $NZBPO_OODBYE"
printenv
# 93 is code for success
exit 93
review UI and addon logs for the dropped h
and g
for this addon ENVs
Logs
info Wed Aug 28 2024 19:19:48 testtruncation: NZBPO_oodbye=goodbye
info Wed Aug 28 2024 19:19:48 testtruncation: NZBOP_TESTTRUNCATION_OODBYE=goodbye
info Wed Aug 28 2024 19:19:48 testtruncation: NZBPO_OODBYE=goodbye
info Wed Aug 28 2024 19:19:48 testtruncation: NZBOP_testtruncation:oodbye=goodbye
info Wed Aug 28 2024 19:19:48 testtruncation: NZBPO_OODBYE: goodbye
info Wed Aug 28 2024 19:19:48 testtruncation: NZBPO_GOODBYE:
Extra information
No response
According to the old documentation, it's required to use the #
symbol and no spaces with options.
Example:
# SMTP server host.
#Server=smtp.gmail.com
# SMTP server port (1-65535).
#Port=25
Apparently, your case has worked before too, but in an implicit way, which caused the confusion.
Please consider using the new v2 extensions as they are more flexible and predictable.
Thanks for getting back to me so quickly. This #
requirement is completely new information to me and explains so much.
I have been using the same simple bash template as a base for creating adhoc addons for as long as I can remember (well over a decade?) and I assume somewhere in there either this changed or I was wrong all along and it just happened to work.
I also had no clue that v2 extensions were a thing.
I will test the #
fix and close this ticket when solved today and look to porting to v2 imminently.
Fix confirmed. Thanks for the assist.