Menu

#2 Option to read parameters from file

v3
closed
fixed (1)
5
2015-05-28
2015-04-09
No

Dialog supports reading parameters from a file, via the '--file' option. It would be nice to have support for this option in pythondialog. This would prevent overly long command lines in the process table which, by the way, could potentially reveal sensitive information to other users.

Discussion

  • Florent Rougon

    Florent Rougon - 2015-04-09
    • summary: optiotn to read parameters from file --> Option to read parameters from file
    • assigned_to: Florent Rougon
    • Series: v4 --> v3
     
  • Florent Rougon

    Florent Rougon - 2015-04-09

    Hello,

    Thank you for the suggestion. While I don't feel much concerned with overly long command lines in this context, I agree that using --file could prevent potential information leaks.

    I haven't tried yet, but from reading dialog's code, it seems to me that pythondialog could rewrite every widget call into a command using --file with a tempfile.NamedTemporaryFile. Probably as an option in case someone doesn't want these temporary files, or to ease debugging.

    I'll get 3.2.2 out and see how this works.

     
  • Florent Rougon

    Florent Rougon - 2015-04-12

    I've looked into it and it's probably doable, but for now it is blocked by a
    few dialog bugs. For instance, you can try 'dialog --file /dev/null' or --file
    with a file containing:

    --msgbox -- --blabla 15 20

    I have preliminary patches to fix these bugs, but one of them will either break compatibility with the way backslash escapes are handled (which is currently unsatisfactory, no way to include a double quote in an argument inside the file, AFAICT) or will require a new option to activate the "correct" parsing behavior.

    I am polishing the patches before I can submit them and discuss how to handle the escaping problem with the dialog maintainer, Thomas Dickey.

     
  • Florent Rougon

    Florent Rougon - 2015-04-27

    FYI, I sent the patches 13 days ago. The dialog maintainer told me he would look at them; I'm waiting for the final answer now.

     
  • Bernd Geiser

    Bernd Geiser - 2015-05-04

    Great. Thanks for your effort!

     
  • Florent Rougon

    Florent Rougon - 2015-05-17

    Good news: dialog 1.2-20150513 incorporates all patches I proposed, including the changes concerning how files included via --file are parsed (double quote and backslash handling).

     
  • Florent Rougon

    Florent Rougon - 2015-05-23

    Hello again,

    The attached patch implements the feature. It is enabled by default but can be switched off with the pass_args_via_file keyword argument to the Dialog constructor. If it works fine for you, I'll add the missing documentation and release.

    Have a nice weekend.

     
  • Florent Rougon

    Florent Rougon - 2015-05-24

    Attaching a new version of the patch which copes with older versions of dialog (and has more doc).

     
  • Florent Rougon

    Florent Rougon - 2015-05-27

    Committed to the Git repo (with doc, new 'expand_file_opt' parameter to setup_debug(), and new demo.py option to have a still-useful debug log with --debug).

    https://sourceforge.net/p/pythondialog/code/

     
  • Florent Rougon

    Florent Rougon - 2015-05-28

    Hello,

    The feature is available in pythondialog 3.3.0.

     
  • Florent Rougon

    Florent Rougon - 2015-05-28
    • labels: --> fixed
    • status: open --> closed
     
  • Bernd Geiser

    Bernd Geiser - 2015-05-28

    Already tested. Works like a charm. Thanks a lot!

     
  • Florent Rougon

    Florent Rougon - 2015-05-28

    You're welcome. Happy hacking!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.