Menu

#360 v2.9.0 - Error message about missing packages, empty locale. But Locale::Codes is installed.

v1.0_(example)
closed-fixed
nobody
None
5
2020-09-25
2020-09-19
No

i've installed gscan2pdf 2.9.0, along with the new perl dependency Locale::Codes.
when i start gscan2pdf, the Messages dialog offers this warning:

Warning: missing packages
You are using locale ''. gscan2pdf does not currently know which tesseract language package would be necessary for that locale. Please contact the developers to add support for that locale.

when i log the startup of gscanpdf 2.9.0 using the --log= option, the logfile contains:

INFO - Starting gscan2pdf 2.9.0
...
INFO - Using en_US.UTF-8 locale
...
INFO - Found tesseract language eng (English)

from the logfile, it looks like gscan2pdf 2.9.0 is correctly recognizing my locale at startup, and correctly recognizing that tesseract language packages are installed, including the one i would expect to use -- but the Messages dialog suggests that an empty or missing locale is detected.

is there anything else i should be configuring to successfully use gscan2pdf 2.9.0?

i am running an up-to-date gentoo (sabayon) linux desktop, and gscan2pdf 2.8.2 works on the same system without any issues.

thanks very much for any help you can offer!

Discussion

  • Jeffrey Ratcliffe

    Thanks for the very quick bug report. $REAL_LIFE got in the way yesterday, and I didn't finish releasing 2.9.0.

    It looks as though the problem is that your system does not set the LANGUAGE variable.

    What does

    locale
    

    return?

     
  • sean dreilinger

    sean dreilinger - 2020-09-20

    greetings Jeffrey Ratcliffe:

    THANKS for writing & maintaining gscan2pdf, i've been using it since the summer of 2008!

    there is no LANGUAGE variable set on this system by default; but LANG is set by default:

    ~ $ set | grep LANG=
    LANG=en_US.UTF-8
    

    i tried setting LANGUAGE like this:

    export LANGUAGE=en_US:en_UK:en_AU
    

    and that allows gscan2pdf 2.9.0 to start without complaint.

    Gentoo linux (and the one Debian linux system i have) do not seem to set a LANGUAGE environment variable by default:

    ~ $ locale
    LANG=en_US.UTF-8
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=
    

    ^ the Debian output of locale shows an empty LANGUAGE= variable.

    there may be more gscan2pdf 2.9.0 users in the same situation -- GNU documentation suggests that a primary language is set in LANG= and a prioritized list of secondary languages can optionally be set in LANGUAGE=

    thanks very much for looking into it!

     

    Last edit: sean dreilinger 2020-09-20
  • Matthias Sprau

    Matthias Sprau - 2020-09-20

    I had the same problem with tesseract-ocr-deu.

     
  • Petr Písař

    Petr Písař - 2020-09-21

    An attached patch fixes it by using more prevalent POSIX locale instead.

    If you want to support the Gettext LANGUAGE variable, you need to process it as a colon-delimited list of languages and to deal with its nonexistence.

     
    👍
    2
  • Jeffrey Ratcliffe

    Thanks to you all for the info and the patch. Committed.

     
    👍
    1
  • Jeffrey Ratcliffe

    • status: open --> closed-fixed
     
  • Matthias Sprau

    Matthias Sprau - 2020-09-22

    An attached patch fixes it by using more prevalent POSIX locale instead.

    How is that to be used?
    Regards

     

    Last edit: Matthias Sprau 2020-09-22
    • Petr Písař

      Petr Písař - 2020-09-23

      Provided your gscan2pdf executable is installed into /usr/local/bin, then e.g. this Unix command does that:

      patch /usr/local/bin/gscan2pdf <gscan2pdf-2.9.0-Use-LC_MESSAGES-locale-category-instead-of-LANGUAGE-.patch
      

      If you don't know how to apply patches, I recommend you to talk to your software vendor.

       
  • Matthias Sprau

    Matthias Sprau - 2020-09-23

    Thanks for help, I needed: sudo patch /usr/bin/gscan2pdf <gscan2pdf-2.9.0-Use-LC_MESSAGES-locale-category-instead-of-LANGUAGE-.patch
    No false warning is presented.

     
  • auv-ee

    auv-ee - 2020-09-23

    My locale returns:

    LANG=en_US
    LC_CTYPE="C"
    LC_NUMERIC="C"
    LC_TIME="C"
    LC_COLLATE="C"
    LC_MONETARY="C"
    LC_MESSAGES="C"
    LC_PAPER="C"
    LC_NAME="C"
    LC_ADDRESS="C"
    LC_TELEPHONE="C"
    LC_MEASUREMENT="C"
    LC_IDENTIFICATION="C"
    LC_ALL=C

    (For various reasons, the C locale is helpful to me.)

    Without the above patch, gscan2pdf thinks the locale is blank, in other words: ''. With the patch, it thinks my locale is 'C', rather than 'en_US'. If I revert the patch, and set the environment variable LANGUAGE to en_US, gscan2pdf is happy with the locale but then complains:

    Warning: missing packages
    PDF encryption requires pdftk

    which it did not complain about before. Evidently, pdftk was removed from Fedora years ago:

    https://ask.fedoraproject.org/t/pdftk-not-available/8062

    and I do have pdf-stapler installed. C'est la vie. I don't use encryption with gscan2pdf.

     
    • Petr Písař

      Petr Písař - 2020-09-23

      Your configuration means your locale is C. LC_ALL overrides all of them and LC_* override LANG. See locale(7) manual.

      Regarding pdftk, Fedora patches out the warning for the very same reason. Maybe you could try installing gscan2pdf from Fedora repositories.

       
      • auv-ee

        auv-ee - 2020-09-23

        Thanks for the info about locale, I'm certainly not very familiar with that (I'm firmly stuck in 7-bit ASCII ;-) ).

        I DO prefer to install from repository, but that is still at 2.7.0, and I need to try 2.9.0 before reporting a different bug. Thanks for the info that Fedora patches-out the pdftk warning. That explains why it started cleanly in the past.

         
        • Petr Písař

          Petr Písař - 2020-09-23

          Fedora 31 cannot upgrade gscan2pdf, because the new version does not work with libtiff-4.0.10. Later Fedoras have newer versions.

           
          • auv-ee

            auv-ee - 2020-09-23

            Thanks again. Yes, still on F31 because it sometimes takes time to recover my work-flow after major upgrades, due to some legacy software that I use. I try to upgrade every-other release to minimize disruption in the middle of large projects.

             
          • Jeffrey Ratcliffe

            What do you mean by "Fedora 31 cannot upgrade gscan2pdf, because the new version does not work with libtiff-4.0.10"? What doesn't work?

             
            • Petr Písař

              Petr Písař - 2020-09-25

              gscan2pdf-2.8.0 t/135_save_tiff_as_ps_with_space.t test hangs in Fedora 31. When I tried upgrading libtiff package from 4.0.10 to 4.1.0, the tests started to pass. I do not remember the details, but I think I concluded that the change in libtiff was intentional and since gscan2pdf works with the newer libtiff, I did not bother to involve you. At the end, Fedora 31 support will end in two months.

               
              • Jeffrey Ratcliffe

                Thanks for the explanation

                 
  • Jeffrey Ratcliffe

    I think I'll extend Petr's patch to follow Sean's suggestions, first trying LANGUAGE, and then the other three possibilities.

     

Log in to post a comment.