Menu

#15 DEFOPTS = 0 in pacpl.conf or .pacplrc not being respected

PACPL
closed
None
5
2018-02-20
2018-02-06
No

I've just installed pacpl from source (version 5.1.1) and I'm configuring it. I've copied /usr/local/etc/pacpl/pacpl.conf to ~/.pacplrc and I've changed/added these options:

DEFOPTS = 0
EOPTS = --preset extreme --id3v2-only

I run pacpl with --dryrun and noticed that the default options are still being picked up:

paulo@monk:~/src/pacpl$ pacpl -t mp3 -r --dryrun ~/stage/cd/Jeremy\ Steig\ -\ Wayfaring\ Stranger/
Perl Audio Converter - 5.1.1
[...]
debug: 
lame --preset extreme --id3v2-only --resample 44100 -b 320 -h "/home/paulo/stage/cd/Jeremy Steig - Wayfaring Stranger/01 - In The Beginning.27812.wav" "/home/paulo/stage/cd/Jeremy Steig - Wayfaring Stranger/01 - In The Beginning.mp3"

I changed the same options in /usr/local/etc/pacpl/pacpl.conf and removed ~/.pacplrc, but the results were the same. I don't program in Perl but glanced through the code and can't decypher why this is happening.

I experimented including --defopts 0 on the command-line and then it works as expected:

paulo@monk:~/src/pacpl$ pacpl -t mp3 --defopts 0 -r --dryrun ~/stage/cd/Jeremy\ Steig\ -\ Wayfaring\ Stranger/
Perl Audio Converter - 5.1.1
[...]
debug: 
lame --preset extreme --id3v2-only  "/home/paulo/stage/cd/Jeremy Steig - Wayfaring Stranger/01 - In The Beginning.29087.wav" "/home/paulo/stage/cd/Jeremy Steig - Wayfaring Stranger/01 - In The Beginning.mp3"

Discussion

  • Paulo Marcel Coelho Aragão

    A rather curious result: I tried putting an invalid value for DEFOPTS in ~/.pacplrc:

    DEFOPTS = 2

    and here's the result:

    paulo@monk:~/src/pacpl$ pacpl -t mp3 -r --dryrun ~/stage/cd/Jeremy\ Steig\ -\ Wayfaring\ Stranger/
    Perl Audio Converter - 5.1.1
    [...]
    Use of uninitialized value $opts in concatenation (.) or string at /usr/local/bin/pacpl line 1129.
    debug: 
    lame --preset extreme --id3v2-only  "/home/paulo/stage/cd/Jeremy Steig - Wayfaring Stranger/01 - In The Beginning.30678.wav" "/home/paulo/stage/cd/Jeremy Steig - Wayfaring Stranger/01 - In The Beginning.mp3"
    
     
  • Paulo Marcel Coelho Aragão

    I changed this line in pacpl:

    # Debugging (for developer use only)
    my $debug = 1;
    

    and ran it again as before, and I can see that the value for DEFOPTS in ~/.pacplrc is being picked up correctly, but the (wrong) results are the same:

    paulo@monk:~/src/pacpl$ ./pacpl -v --dryrun -t mp3 -r ~/stage/cd/Jeremy\ Steig\ -\ Wayfaring\ Stranger/
    debug: loaded configuration file: /home/paulo/.pacplrc
    [...]
    debug: DEFOPTS = 0
    debug: EOPTS = --preset extreme --id3v2-only
    [...]
    debug: 
    lame --preset extreme --id3v2-only --resample 44100 -b 320 -h "/home/paulo/stage/cd/Jeremy Steig - Wayfaring Stranger/01 - In The Beginning.32387.wav" "/home/paulo/stage/cd/Jeremy Steig - Wayfaring Stranger/01 - In The Beginning.mp3"
    
     
  • Paulo Marcel Coelho Aragão

    I believe I found the bug ! But I don't know Perl enough to correct it :-( It's here:

        # now read config file options and change default values accordingly.
        foreach (@conf_opts) {
            chomp;
            my ($k, $v) = split(/\s*=\s*/);
                $config{$k} = $v if exists($config{$k}) and $v;
                say "$lang{debug} $k = $v" if $debug == 1 and exists($config{$k});
        }
    

    Specifically in this line:

                $config{$k} = $v if exists($config{$k}) and $v;
    

    As my ~/.pacplrc has this line:

    DEFOPTS = 0
    

    $v will be 0, which I imagine Pearl treats as false, so $config{$k} = $vis not run.

     
  • Paulo Marcel Coelho Aragão

    Well, found out how to fix the bug: replace this line:

               $config{$k} = $v if exists($config{$k}) and $v;
    

    with:

                $config{$k} = $v if exists($config{$k}) and length($v);
    

    I'm working my way around git, I'll try to send a patch or perhaps submit a pull request.

     
  • Paulo Marcel Coelho Aragão

    Not sure if I did things in the correct/recommended way:

    1. Created a new branch: fix_config_value_0
    2. Amended pacpl.in, and added/committed it
    3. Checked-out master and created the patch with:
      git diff master fix_config_value_0 >fix_config_value_0.patch

    The patch is attached to this post.

     
  • Philip Lyons

    Philip Lyons - 2018-02-07
    • status: open --> pending
    • assigned_to: Philip Lyons
     
  • Philip Lyons

    Philip Lyons - 2018-02-20
    • status: pending --> closed
     
  • Philip Lyons

    Philip Lyons - 2018-02-20

    when using defopts you'll need to include the --eopts option on the command line with your desired changes in quotation marks.

     
  • Paulo Marcel Coelho Aragão

    There's no need to use the --eopts command line option if you use the EOPTS option in the configuration file. That's what I've been using. It's in your code, have a look, it's there. Your code needs fixing, it's not handling DEFOPTS correctly, as I debugged and demonstrated. I've sent you a patch, it's just a question of applying it. As you can see, it's a very simples correction. You can't just dismiss an issue like this and leave the code faulty. I'm really stunned at your complete disregard.

     

Log in to post a comment.