mquinson / po4a

Maintain the translations of your documentation with ease (PO for anything)
http://po4a.org/
GNU General Public License v2.0
127 stars 62 forks source link

Temp pot file not created #438

Closed romualdginhoux closed 5 months ago

romualdginhoux commented 1 year ago

Dear support, I am changing from po4a-update and po4a-translate to the unique command po4a with a config file. Running this make command from my Debian terminal:


make -f Makefile_new test     
docker run --rm -v /mnt/wsl/docker-desktop-bind-mounts/Debian/74785125ce41b9ccfa5891df319fa5b7623b0cd52a854300fb96910c7df0b9b7:/documents axilumdocker.azurecr.io/docker-dblatex:v2  po4a --verbose "po4a.cfg" --no-translations --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/"
Split mode, creating a temporary POT: (15 entries)
msggrep did not create '/tmp/po4awIAC.pot'. Used command:
  msggrep  -N "modules/ts/pages/sandbox-mini.adoc" -o /tmp/po4awIAC.pot /tmp/po4a-temp-pot-p6ku.pot
Please report that bug, along the information allowing to reproduce it.

Here is how the "test" target is defined in my makefile:

test:
    $(DOCKER) $(ACR)/docker-dblatex:$(PO4A_VERSION) $(PO4A) "po4a.cfg" --no-translations --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/"
    $(DOCKER) $(ACR)/docker-dblatex:$(PO4A_VERSION) $(PO4A) "po4a.cfg" --no-update --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/"

Looking at the /tmp directory, there is no "temp-pot" file created. Then I tried to run this failing msggrep command directly as a "toto" target but it fails as well, confirming the absence of the "po4a-temp-pot-p6ku.pot" file. Any idea what is wrong?

toto:
    $(DOCKER) $(ACR)/docker-dblatex:$(PO4A_VERSION) msggrep  -N "docs/tms-cobot-docs/modules/ts/pages/sandbox-mini.adoc" -o /tmp/po4awIAC.pot /tmp/po4a-temp-pot-p6ku.pot

Attached in my po4a.cfg file

po4a.cfg.txt

Looking forward to your help. Best regards

romualdginhoux commented 1 year ago

I am using po4a version 0.69 on Debian bookworm.

romualdginhoux commented 1 year ago

Hi, any idea on this? I can confirm that I get the same errors when I execute the commands directly in the linux prompt (without going through a docker image):

po4a po4a.cfg --no-translations --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/" po4a po4a.cfg --no-update --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/" msggrep -N "docs/tms-cobot-docs/modules/ts/pages/sandbox-mini.adoc" -o /tmp/po4awIAC.pot /tmp/po4a-temp-pot-p6ku.pot

(of course replacing the name of pot files with the names reported in the errors of the first two po4a calls.)

jnavila commented 1 year ago

@romualdginhoux can you provide a complete reproducible sample?

romualdginhoux commented 1 year ago

Using the po4a.cfg I have attached in the first post, here is the output showing an issue with msggrep. Then if I run the msggrep command myseld with the same arguments, there is no issue shown in the output, but doing a "ls" reveals the tmp file is not there. What do you think?

romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/git_axilum_userguides$ po4a po4a.cfg --no-translations --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/" (15 entries) msggrep did not create '/tmp/po4amNXf.pot'. Used command: msggrep -N "modules/ts/pages/sandbox-mini.adoc" -o /tmp/po4amNXf.pot /tmp/po4a-temp-pot-QHuL.pot Please report that bug, along the information allowing to reproduce it.

romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/git_axilum_userguides$ po4a po4a.cfg --no-update --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/" (15 entries) romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/git_axilum_userguides$ msggrep -N "modules/ts/pages/sandbox-mini.adoc" -o /tmp/po4amNXf.pot /tmp/po4a-temp-pot-QHuL.pot romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/git_axilum_userguides$ ls /tmp/po4amNXf.pot ls: cannot access '/tmp/po4amNXf.pot': No such file or directory romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/git_axilum_userguides$ sudo ls /tmp/po4amNXf.pot [sudo] password for romuald: ls: cannot access '/tmp/po4amNXf.pot': No such file or directory romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/git_axilum_userguides$

jnavila commented 1 year ago

What is the content of sandbox-mini.adoc?

romualdginhoux commented 1 year ago

See attached file with its included sandbax-include.adoc file:

sandbox-mini.adoc.txt sandbox-include.adoc.txt

jnavila commented 1 year ago

Thank you.. Digging a bit, I found that the option "--porefs never" is linked to this error. If you remove this option, it seems to work (but it generates the po refs, of course). Note also that there was a patch lately (1dcd8bf) that removed the error when the pot file is empty (making your case fail without any error now).

It seems to be a regression, culprit is 1177a680edf2e93945b45b7083c6d868b044a5c6

@mquinson any idea?

jnavila commented 1 year ago

I ran the previous git bisect with the command line po4a ../test_po4a/po4a.conf --srcdir=../test_po4a and found 1177a68 , which is indeed related to srcdir option, but still quite weird as a possible source for the management of porefs. In fact, this is the first time the srcdir option is implemented, so I guess it is a false positive.

Then I ran the command po4a po4a.conf after cd'ing into test_po4a, and git blame gave me another culprit: 3189219a1c497714ace21b566fba25c6052eed5c

which seems more in line with the observed behavior. Anyway, it is not directly related to asciidoc processing, so I'll let someone more versed into options management have a look.

mquinson commented 10 months ago

I'm sorry, but I fail to reproduce this error. Could you please provide me with a zip file with all needed files? For example, the po4a.cfg that you provided cannot work in a separate directory because the files are in deeply nested subdirectories.

Also, it's a bit surprising to have no PO files in your example, and my recent changes to fix #442 may impact on my result.

I tried to update your config file to that content:

[options] --package-name "User Guides"               \
          --master-charset UTF-8                     \
          --localized-charset UTF-8                  \
          --porefs never                             \
          --wrap-po 79                               \
          -o tablecells

[po4a_langs] en
[po4a_paths] $master.pot  $lang:$master.$lang.po

[type: asciidoc] sandbox-mini.adoc \
                 $lang:sandbox-mini.$lang.adoc

[type: asciidoc] sandbox-include.adoc \
                 $lang:sandbox-include.$lang.adoc \
                 pot=sandbox-include.adoc

But then it works for me. Or, it does things, but I'm doubtful about the result. It seems that msginit does weird things when used on the language code 'en'. Plus, po4a says that it's skipping a file, and then generate it... I need a config file that reproduces the issue for you, to investiguate it here.

mquinson@cafuron:~/Code/po4a/t$ rm -rf tmp/ ; mkdir tmp;LC_ALL=C PERL5LIB=../lib perl ../po4a -f /tmp/po4a.cfg --destdir tmp/ --verbose --srcdir /tmp/ 
Split mode, creating a temporary POT: (22 entries)
The translation of master file 'sandbox-include.adoc' in language 'en' is missing (file: sandbox-include.adoc.en.po) -- skipping.
The translation of master file 'sandbox-mini.adoc' in language 'en' is missing (file: sandbox-mini.adoc.en.po) -- skipping.
Creating an empty PO file for the language en.
sandbox-mini.en.adoc is 100% translated (15 strings).
sandbox-include.en.adoc is 100% translated (7 strings).
mquinson@cafuron:~/Code/po4a/t$ 

Thanks for reporting, and sorry for the delay. Mt

romualdginhoux commented 10 months ago

Hi, thanks for checking this! Here is a ZIP package containing the sample files and the directory structure, tmp.zip, where the error continues to happen:

po4a --verbose "po4a.cfg" --no-translations --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/" Split mode, creating a temporary POT: (20 entries) msggrep did not create '/tmp/po4aKjvP.pot'. Used command: msggrep -N "modules/ts/pages/sandbox-mini.adoc" -o /tmp/po4aKjvP.pot /tmp/po4a-temp-pot-N2zu.pot Please report that bug, along the information allowing to reproduce it.

po4a --verbose "po4a.cfg" --no-update --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/" Split mode, creating a temporary POT: (20 entries) The translation of master file 'modules/ts/pages/sandbox-include.adoc' in language 'en' is missing (file: po/sandbox-include.adoc/en.po) -- skipping. The translation of master file 'modules/ts/pages/sandbox-mini.adoc' in language 'en' is missing (file: po/sandbox-mini.adoc/en.po) -- skipping. PO file for language en is missing -- skipping.

I am using po4a version 0.69 on Debian bookworm https://packages.debian.org/bookworm/po4a. Can you reproduce this issue? Regards

qwrtln commented 7 months ago

I'm using po4a in my project and I seem to be stumbling upon this too. I want to run po4a as a CI step. Here's the faulty run: https://github.com/Heegu-sama/Homm3BG/actions/runs/8637714709/job/23680546974#step:3:126 All the other files exist, as seen in the ls -R output above. It's the po file in /tmp that's missing. I'm just downloading v0.71 from your GitHub release page directly. Is there any work around for this? If not, do you know any other way I could run po4a in GitHub workflows? So far, all my efforts are futile.

qwrtln commented 7 months ago

I managed to solve it by installing po4a (and its deps) via apt, while using the version from GitHub anyway. msgcat wasn't available otherwise, and the apt version of po4a did not work at all. Here's a PR with this if you're interested: https://github.com/Heegu-sama/Homm3BG/pull/133/files Not ideal, but it gets the job done.

mquinson commented 6 months ago

I managed to solve it by installing po4a (and its deps) via apt, while using the version from GitHub anyway. msgcat wasn't available otherwise, and the apt version of po4a did not work at all. Here's a PR with this if you're interested: https://github.com/Heegu-sama/Homm3BG/pull/133/files Not ideal, but it gets the job done.

Hello @qwrtln, I think that your problem is not the one reported in this issue, please open another issue on need. I think that your problem could be fixed by installing the gettext package from apt instead of po4a, as msgcat is not provided by po4a but by gettext. Again, please open another issue on need.

mquinson commented 6 months ago

Hi, thanks for checking this! Here is a ZIP package containing the sample files and the directory structure, tmp.zip, where the error continues to happen:

po4a --verbose "po4a.cfg" --no-translations --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/" Split mode, creating a temporary POT: (20 entries) msggrep did not create '/tmp/po4aKjvP.pot'. Used command: msggrep -N "modules/ts/pages/sandbox-mini.adoc" -o /tmp/po4aKjvP.pot /tmp/po4a-temp-pot-N2zu.pot Please report that bug, along the information allowing to reproduce it.

po4a --verbose "po4a.cfg" --no-update --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/" Split mode, creating a temporary POT: (20 entries) The translation of master file 'modules/ts/pages/sandbox-include.adoc' in language 'en' is missing (file: po/sandbox-include.adoc/en.po) -- skipping. The translation of master file 'modules/ts/pages/sandbox-mini.adoc' in language 'en' is missing (file: po/sandbox-mini.adoc/en.po) -- skipping. PO file for language en is missing -- skipping.

I am using po4a version 0.69 on Debian bookworm https://packages.debian.org/bookworm/po4a. Can you reproduce this issue? Regards

Hello @romualdginhoux,

I still fail to reproduce your problem with the zip file:

mquinson@yalla:/tmp$ cd /tmp/ ; rm -rf tmp; unzip ~/Téléchargements/tmp.zip ; cd tmp ; PERL5LIB=~/Code/po4a/lib/ ~/Code/po4a/po4a --verbose po4a.cfg --no-translations --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/"
Archive:  /home/mquinson/Téléchargements/tmp.zip
   creating: tmp/docs/
   creating: tmp/docs/tms-cobot/
   creating: tmp/docs/tms-cobot/docs/
   creating: tmp/docs/tms-cobot/docs/modules/
   creating: tmp/docs/tms-cobot/docs/modules/ts/
   creating: tmp/docs/tms-cobot/docs/modules/ts/pages/
  inflating: tmp/docs/tms-cobot/docs/modules/ts/pages/sandbox-include.adoc  
  inflating: tmp/docs/tms-cobot/docs/modules/ts/pages/sandbox-mini.adoc  
   creating: tmp/docs/tms-cobot/docs/po/
   creating: tmp/docs/tms-cobot/docs/po/sandbox-include.adoc/
   creating: tmp/docs/tms-cobot/docs/po/sandbox-mini.adoc/
   creating: tmp/docs/tms-cobot/docs/translations/
   creating: tmp/docs/tms-cobot/docs/translations/en/
   creating: tmp/docs/tms-cobot/docs/translations/en/ts/
   creating: tmp/docs/tms-cobot/docs/translations/en/ts/pages/
  inflating: tmp/po4a.cfg            
Split mode, creating a temporary POT: (20 entries)
The translation of master file 'modules/ts/pages/sandbox-include.adoc' in language 'en' is missing (file: po/sandbox-include.adoc/en.po) -- skipping.
The translation of master file 'modules/ts/pages/sandbox-mini.adoc' in language 'en' is missing (file: po/sandbox-mini.adoc/en.po) -- skipping.
Creating an empty PO file for the language en.
Cannot create directory 'po/sandbox-include.adoc': No such file or directory
mquinson@yalla:/tmp/tmp$ 

I'm not sure of how I'm supposed to run po4a in your example. I have the command line, but which directory are you in when you run it?

Sorry for the delay, and thanks for any additional info you could provide.

romualdginhoux commented 6 months ago

Hi, thanks for checking this again!

I am running po4a from the tmp/ dir.

Then the issue might come from my local environment? My Linux Debian Bookworm is running on WSL 2 (https://docs.docker.com/desktop/wsl/) and I am running commands in a WSL terminal from Microsoft Visual Studio Code, where I get the issue I submitted here. (Then this local environment is replicated in a Docker environment for an Azure pipeline, where the issue happens too, of course).

I have redone all apt-get updates and upgrades, without any effect (Debian 12, po4a v0.69-1, gettext 0.21-12).

Then I have downloaded latest po4a version 0.71 from https://github.com/mquinson/po4a/files/14453212/po4a-0.71.tar.gz as done by @qwrtln, and repeating the commands in my tmp/ example shows that the issue has disappeared!

romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/tmp$ ../../Downloads/po4a-0.71.tar/po4a-0.71/po4a --verbose "po4a.cfg" --no-translations --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/"
Split mode, creating a temporary POT: (20 entries)
The translation of master file 'modules/ts/pages/sandbox-include.adoc' in language 'en' is missing (file: po/sandbox-include.adoc/en.po) -- skipping.
The translation of master file 'modules/ts/pages/sandbox-mini.adoc' in language 'en' is missing (file: po/sandbox-mini.adoc/en.po) -- skipping.
Creating an empty PO file for the language en.
Cannot create directory 'po/sandbox-include.adoc': No such file or directory

romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/tmp$ ../../Downloads/po4a-0.71.tar/po4a-0.71/po4a --verbose 
"po4a.cfg" --no-update --srcdir="docs/tms-cobot/docs/" --destdir="docs/tms-cobot/docs/"
Split mode, creating a temporary POT: (20 entries)
The translation of master file 'modules/ts/pages/sandbox-include.adoc' in language 'en' is missing (file: po/sandbox-include.adoc/en.po) -- skipping.
The translation of master file 'modules/ts/pages/sandbox-mini.adoc' in language 'en' is missing (file: po/sandbox-mini.adoc/en.po) -- skipping.
PO file for language en is missing -- skipping.

Therefore I should definitely use this downloaded package on top of the native Debian package, as noted by @qwrtln.

When trying this, I have noticed that po4a version 0.71 still reports it is a v0.69 (see below), is that expected or would you fix it?

romuald@OBERKIRCH:/mnt/c/Users/romua/Documents/tmp$ ../../Downloads/po4a-0.71.tar/po4a-0.71/po4a --version
po4a version 0.69.
Written by Martin Quinson and Denis Barbier.

Copyright © 2002-2022 Software in the Public Interest, Inc.
This is free software; see source code for copying
conditions. There is NO warranty; not even for
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks for your help. I think this issue can be closed now.