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

-E parameter: Error Option -E requires a parameter #68

Closed
christianTF opened this Issue Sep 11, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@christianTF
Copy link

christianTF commented Sep 11, 2018

Hi framp,

to address christianTF/LoxBerry-Plugin-LoxberryBackup#15 I have a question to the -E parameter.

Version: 0.6.4 CommitSHA: a0a982d CommitDate: 2018-09-08 CommitTime: 15:56:00

To add the From address to sendmail, I call raspibackup with the -E parameter.

/usr/local/bin/raspiBackup.sh -e my@address.at -E "-r my@address.at" -F -N "fstab disk temp" -o ":" -a ":" -k 3 -t rsync -L current -m detailed /opt/loxberry/system/storage/usb/9daec47a-01/backup
leading to
??? RBK0090E: Option -E requires a parameter. <ERROR> Backup failed with error code 107

I'm sure, that this at some time did work, but currently it does not, and I have no idea how to use the -E parameter.

Can you give me advise.

Thanks!
Christian

@framps framps self-assigned this Sep 11, 2018

@framps framps added the bug label Sep 11, 2018

@framps

This comment has been minimized.

Copy link
Owner

framps commented Sep 11, 2018

Root cause is the new option parser which complaints about -r in -E "-r my@address.at" because that's identified as a new option by the parser which is incorrect. Right now you cannot start a parameter with - , --, + and ++.
I either remove this check which will cause mysterious error messages when a mandatory parameter is missing or find a solution how to pass a parameter starting with -,--,++ and +.
...thinking...

@christianTF

This comment has been minimized.

Copy link
Author

christianTF commented Sep 11, 2018

Ok, don't worry - I remove the -E parameter and the mails will be sent from root now.
As LoxBerry also has it's own notification system, users can decide between raspiBackup or LoxBerry notification.

It would be an option to directly provide a "from" parameter, as usually the sender always is root, and this never looks nice.

And I indeed was right that this was working in the past ;-)

Thanks for your effort!

@framps

This comment has been minimized.

Copy link
Owner

framps commented Sep 12, 2018

That's a general issue with option parameters. So I created a fix https://github.com/framps/raspiBackup/blob/escaped_parameters/raspiBackup.sh.

You now have to start an option parameter with \ whenever your parameter starts with one of the following strings -,--,+,++. This way you escape the first parameter string and they are no longer identified as options for raspiBackup. \ will be removed from the parameter when used by raspiBackup.

@christianTF Please verify the fix (Take your time. I will roll in the fix in the next raspiBackup release)

@framps

This comment has been minimized.

Copy link
Owner

framps commented Oct 13, 2018

Fix was merged into 0.6.4.1 beta

@framps

This comment has been minimized.

Copy link
Owner

framps commented Oct 28, 2018

I just got another user facing the same issue 😢 .

Requiring \ in front of the parameter is a backward incompatible change which should be avoided. Therefore I added another workaround (2) and we have now:

  1. Prefix a parameter starting with - with \
  2. A parameter with leading - is considered not to be an option for raspiBackup if the parameter string contains at least one space.

Examples:
-E "-r my@address.at" -> backward compatible to pre 0.6.4.1 versions of raspiBackup
-E "fileName" -> backward compatible to pre 0.6.4.1 versions of raspiBackup
-E "\-x" -> not backward compatible to pre 0.6.4.1 versions of raspiBackup
-E " -x" -> not backward compatible to pre 0.6.4.1 versions of raspiBackup
-E "-x " -> not backward compatible to pre 0.6.4.1 versions of raspiBackup

@framps framps closed this Jan 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment