[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work

From: Christian Grothoff
Subject: Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected
Date: Fri, 15 Mar 2019 06:09:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

Hi Hartmut,

I've looked over the code now.  A few comments:

1) I've changed to actually make the check for *optional*
libzbar work, so that if libzbar is not present configure still runs.
Also removed use of pkgconfig (unnecessary).

2) I think you really should link against libgnuetutil and make use of
our GNUNET_GETOPT_- and GNUNET_log() APIs. Sure, that isn't a big
savings for the tiny program, but it helps keep things uniform (and
right now your logging is different from all the other logging in GNUnet).

3) You're missing the (obvious) error handling required, as your
comments clearly say.

4) For me, the -c option works here just fine. Maybe it got fixed already?

5) Indentation style is off from what we prefer
( may help). But not bad, just different.

6) i18n is missing for user output.

7) The use of the 'fork_and_exec' logic is non-portable. I don't know if
libzbar is portable, but if it is, you should use the
GNUNET_OS_command_run() API instead, obtaining a portable version of the
essentially the same logic (modulo the /dev/null handling, but this is
not required here anyway).

Happy hacking!


On 3/13/19 6:25 PM, Hartmut Goebel wrote:
> Hi Martin,
> Am 03.03.19 um 11:33 schrieb Schanzenbach, Martin:
>> The first thing you should do it use GNUNET_PROGRAM*.
> I followed this advice, adding options --verbose, -s/--silent and
> -d/--device. Here is the resulting help output, which look s good::
>  src/util/gnunet-qr --help
> gnunet-qr
> Scan a QR code using a video device and import the uri read
> Arguments mandatory for long options are also mandatory for short options.
>       --verbose              be verbose
>   -c, --config=FILENAME      use configuration file FILENAME
>   -d, --device=DEVICE        use video-device DEVICE (default: /dev/video0
>   -h, --help                 print this help
>   -L, --log=LOGLEVEL         configure logging to use LOGLEVEL
>   -l, --logfile=FILENAME     configure logging to write logs to FILENAME
>   -s, --silent               do not show preview windows
>   -v, --version              print the version number
> Report bugs to address@hidden
> GNUnet home page:
> General help using GNU software:
> But the resulting program does not work as expected:
>  1. gnunet-qr -c src/my/test_my.conf
>     -> invalid option -- c
>     Curiously gnunet-ecc accepts this option.
>  2. gnunet-qr --config ./src/my/test_my.conf
>     fails with "`stat' failed on file
>     `/opt/gnunet/share/gnunet/config.d' [...]error: Datei oder
>     Verzeichnis nicht gefunden"
>     Why does the program try to access this directory when I passed an
>     config-file?
>     "/opt/gnunet" is the prefix I configured, thus the directory name
>     makes sense.  gnunet-ecc has the same issue.
> I just pushed the code to branch gnunet-qt-c-2 (force-pushing to the
> prior branch was denied)
> -- 
> Regards
> Hartmut Goebel
> | Hartmut Goebel          | address@hidden               |
> | | compilers which you thought are impossible |
> _______________________________________________
> GNUnet-developers mailing list
> address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]