Giter Site home page Giter Site logo

sabotage-linux / gettext-tiny Goto Github PK

View Code? Open in Web Editor NEW
63.0 63.0 15.0 527 KB

stub and/or lightweight replacements of the gnu gettext suite; because the GNU one takes ages to compile

Home Page: http://ftp.barfooze.de/pub/sabotage/tarballs/

License: Other

Shell 2.24% C 17.34% Makefile 1.05% M4 79.37%

gettext-tiny's People

Contributors

awilfox avatar felixonmars avatar giuliobenetti avatar kaniini avatar lanodan avatar mako2580 avatar maxcrees avatar midipix avatar mndrix avatar ptrcnull avatar rofl0r avatar vkochan avatar xhebox avatar yukarichiba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gettext-tiny's Issues

#fuzzy mark

#: free.c:77
#, fuzzy
msgid "     --kilo          show output in kilobytes\n"
msgstr " -k, --kilo          Ausgabe in Kilobyte anzeigen\n"

Fuzzy mark is generally added automatically due to auto merging. It's a bit similar to FIXME. and the content after it(just one group of msgid/str) should be treated as junk.

`msgmerge --version` confuses CMake

CMake expects msgmerge --version to match the following regular expression:

^msgmerge \(.*\) ([^0-9.]+)

As it stands, that is not the case. This causes CMake to fail its own test suite (GETTEXT_VERSION_STRING is not defined despite GETTEXT_FOUND); if that test failure is ignored, it still won't set GETTEXT_VERSION_STRING correctly, which some packages use.

I've written a very silly patch (that I will happily submit as a PR, if that would be easier for you) that fixes this:

--- gettext-tiny-0.3.0_pre1/src/msgmerge.c.old  2018-06-20 23:47:19.927932643 -0500
+++ gettext-tiny-0.3.0_pre1/src/msgmerge.c      2018-06-20 23:55:12.997464272 -0500
@@ -18,7 +18,7 @@
 __attribute__((noreturn))
 static void version(void) {
        fprintf(stdout,
-               "these are not (GNU gettext-tools) 99.9999.9999\n");
+               "msgmerge (GNU gettext-tools; compatible) 0.19 (gettext-tiny) 0.3.0\n");
        exit(0);
 }
 

However, I'm not sure if any other package looks for the exact string "(GNU gettext-tools)"... so I'm not sure if this is mergable as-is.

Further direction would be welcome and I'll be happy to build and test against whatever changes necessary. If you would like to test yourself, from a built CMake tree run:

bin/ctest -R CMakeOnly.AllFindModules

`autopoint` doesn't handle unquoted aux dirs correctly

Elizafox/tre-regex-sys#1 has led me to a curious thing:

AC_CONFIG_AUX_DIR(utils)

will break gettext-tiny's autopoint:

awilcox on gwyn ~/Code/contrib/tre-regex-sys/tre % find . -name config.rpath
./AC_CONFIG_AUX_DIR(utils)/config.rpath

because it doesn't have the bracket quotes that autopoint is expecting:

  if [ "${line##*AC_CONFIG_AUX_DIR}" != "$line" ]; then
    dirprefix="${line##*([}"
    dirprefix="${dirprefix%%])*}"
    mkdir -p "${dirprefix}"
  fi

Trying to see if we can find an easy fix.

TODO: debloat m4 files

there are some m4's that have huge non-sense comments that can be removed

others have huge non-sense configure compiletime checks for 30 year old HP-UX, AIX, etc.

generally it seems that most of what the m4s do is nonsense thats not needed when using a compliant libc. so probably most of the m4 macros could be equipped with an empty body.

config.rpath missing when AC_CONFIG_AUX_DIR is set

Hi,
I discovered that config.rpath is missing when AC_CONFIG_AUX_DIR is set in configure.ac. And that's because you touch config.rpath in autopoint but you are not checking AC_CONFIG_AUX_DIR destination. That is 'build-aux' for example in acl and attr package. I also created dirty fix patch for it.
auxdir.patch.txt

TODO: handle both --args xx and --args=xx

#53 is OK. But I noticed something: there are lots of options only handle --arg xx, or --arg=xx.

We could let the current argument parser eat extra =. But we need to check --template-xx before --template, or we may recognize --template-xx as --template.

Or we could move to getopt.

autopoint.in violates POSIX sh

Patch:

--- autopoint.in~	2024-01-20 22:53:28.014897848 +0100
+++ autopoint.in	2024-01-20 22:53:58.155007025 +0100
@@ -15,8 +15,8 @@ dirprefix=""
 while read line
 do
   if [ "${line##*AC_CONFIG_AUX_DIR}" != "$line" ]; then
-    dirprefix="${line##*([}"
-    dirprefix="${dirprefix%%])*}"
+    dirprefix="${line##*\([}"
+    dirprefix="${dirprefix%%]\)*}"
     mkdir -p "${dirprefix}"
   fi
   

Unfortunately, shellcheck does not yet flag this; I’ve filed a feature request with them for it.

The root cause of the issue is that POSIX requires “the application” (the script / script writer) to escape special characters because “the implementation” (the shell) to add extensions to otherwise invalid cases. All Korn shells do this:

$ foo='abbbc'; echo "${foo##a*(b)}"
c

POSIX is derived from the Korn shell, so this is permitted.

Note that you could even do…

+    dirprefix=${line##*\([}
+    dirprefix=${dirprefix%%]\)*}

… as the outer doublequotes around a ${…} expression used as RHS of a shell variable (POSIX: shell parameter) assignment are almost always redundant.

Another alternative spelling:

+    dirprefix=${line##*"(["}
+    dirprefix=${dirprefix%%"])"*}

msgfmt tries to open file named --xml when building AppStream or Desktop Entry files

Environment

  • HexChat 2.14.1
  • Meson 0.47.0
  • gettext-tiny master

Steps to reproduce

mkdir _build
cd _build
meson -Dprefix=/usr -Dwith-lua=false
ninja

Actual results

[32/92] Generating io.github.Hexchat.desktop_merge with a custom command.
FAILED: data/misc/io.github.Hexchat.desktop 
/usr/bin/python3 /usr/bin/meson --internal msgfmthelper data/misc/io.github.Hexchat.desktop.in data/misc/io.github.Hexchat.desktop desktop ../data/misc/../../po
fopen: No such file or directory

Using strace we see the issue:

execve("/usr/bin/msgfmt", ["msgfmt", "--xml", "-d", "../data/misc/../../po", "--template", "../data/misc/io.github.Hexchat.a"..., "-o", "data/misc/io.github.Hexchat.appd"...], 0x3fffd39336a0 /* 46 vars */) = 0
open("--xml", O_RDONLY|O_LARGEFILE)     = -1 ENOENT (No such file or directory)

Notes

Even if --xml support was added (or just ignored), there's no support for --template which is used for Desktop Entry stuff in GNU msgfmt.

I don't have any experience with this stuff at all. I've always written my own Desktop Entry files using the embedded translation syntax, and I have no experience with AppStream. In fact this is the first time I've even heard of it.

xgettext fails to parse arguments

Msgmerge exits with:
fopen: No such file or directory

when called with these flags:
msgmerge -U --no-wrap --no-location --backup=none -q -N po/lt_LT.po po/vnsiserver.pot

I've tried setting first argument of set_file() in the case of .pot files that should make fopen using "w" but what I obtain is an output to stdout and a zero length output file.
Can you fix it please?

It doesn't support update functionality too, can you implement it?

Thanks in advance

`msgformat` incorrectly handles .po files containing plural forms

Description

When an entry in .po files contains msgid_plural field, if all msgstr[] are null, an entry is generated that does not contain msgstr[], which will cause subsequent msgfmt to error.

This issue is originally appeared in building warzone2100 4.4.2 using gettext-tiny.

Reproduce

Files

test.pot

msgid "test1 %s"
msgid_plural "tests1 %s"
msgstr[0] ""
msgstr[1] ""

msgid "test2 %s"
msgid_plural "tests2 %s"
msgstr[0] ""
msgstr[1] ""

test.po

msgid "test1 %s"
msgid_plural "tests1 %s"
msgstr[0] ""

msgid "test2 %s"
msgid_plural "tests2 %s"
msgstr[0] "translated test2 %s"

gettext-tiny

$ msgmerge ./test.po ./test.pot | tee ./test.merged.po && msgfmt -o /dev/null ./test.merged.po
msgid "test1 %s"
msgid_plural "tests1 %s"

msgid "test2 %s"
msgid_plural "tests2 %s"
msgstr[0] "translated test2 %s"
$ echo $?
251

gettext (GNU)

$ msgmerge ./test.po ./test.pot | tee ./test.merged.po && msgfmt -o /dev/null ./test.merged.po
msgid "test1 %s"
msgid_plural "tests1 %s"
msgstr[0] ""

msgid "test2 %s"
msgid_plural "tests2 %s"
msgstr[0] "translated test2 %s"
$ echo $?
0

Error building openbox.

Building openbox from git master:

+ aclocal -I m4
configure.ac:99: warning: macro 'AM_GNU_GETTEXT_VERSION' not found in library
configure.ac:100: warning: macro 'AM_GNU_GETTEXT' not found in library
+ autoconf
configure.ac:99: error: possibly undefined macro: AM_GNU_GETTEXT_VERSION
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:100: error: possibly undefined macro: AM_GNU_GETTEXT
=======> ERROR: Building '/usr/src/pkg/pkg/openbox#git-3.pkg.tar.gz' failed.

transformation of bogus <SYSDEP> strings

to support message strings like "foo %<PRIuMAX> bar"
these are called "sysdep segments"
https://www.sourceware.org/ml/libc-alpha/2002-07/msg00202.html

the whole point of having compiled .mo files is to use them as const, in-place data...but this feature requires EVERY PROCESS using the message to make its own, patched-in-nonshared-memory, copy of the strings

  1. they could have achieved the same thing by having msgfmt just sub-in all possible definitions for the format, and output one pair of strings for each possibility
  2. PRIuMAX is "ju". there is no other possible value. and whenever you can't use a known integer type, you can use %jd or %ju and a cast to uintptr_t or intptr_t to print
    in the case of 2, it was idiots who wanted to support mingw's broken printf who pushed for it...
    (yet these same people are using gnulib, which replaces mingw's printf because it's broken...)
    TODO:
    fixing these idiotic strings by replacing them with the only definition (for the ones that only have one valid definition) or two definitions (for the ones that could be l or ll depending on 32-/64-bit host) and generating flat files that can be used in-place

support for mingw/platforms with separate libiconv

from #31 / #32

@xhebox suggests to use pkg-config to check for libiconv

LDFLAGS=$(pkg-config --silence-errors --libs iconv)

Tested both under win+msys2+pkg-config and linux(musl&glibc in schroot)+pkgconf. When we need iconv, there will be a flag; when there's no iconv(musl), it wont print errors so that there're no redundant strings in LDFLAGS.

And maybe we could set a new variable PKG_CONFIG to let users choose their own pkgconf command. And maybe do not try to be smart if users said there's no pkgconf(PKG_CONFIG==NULL)?

i'm not certain. does mingw ship pkg-config support files for libiconv ? that sounds odd.
i'm also hesitant to pull in a dependcy on a new build tool requirement and associated maintenance work.

imo the "cleanest" solution would be to have a separate "configure" check:
checking whether we need -liconv for iconv_open()... no
but well... we don't use autoconf and writing such checks for Makefiles is tricky.

now that LDFLAGS is in the right position, we could just write into README:
if you use mingw, use make LDFLAGS=-liconv.

can't compile anymore

cc  -static -o msgfmt src/msgfmt.o src/poparser.o src/StringEscape.o -liconv
/bin/ld: cannot find -liconv

support auto generation of po Makefile

the original stub lacks install: causing errors. 092551b

and then tried the Makefile template and remove-potcdate.sin from gnu, stuck at msgmerge:

/bin/msgmerge --update  --lang=bg --previous bg.po tilda.pot
error: update functionality unimplemented

EDIT: closed by #13, with some help from @rofl0r

TODO: add autopoint

this is supposed to drop some m4 junk used by automake.
it basically is only needed when git checkouts are used instead of release tarballs, so you have to generate the configure script yourself.

it shouldnt be too hard; maybe attach strace to a autopoint run on a gnu machine and figure what it writes. apparently procps-ng needs it when you run autogen.

Any updates on a new release?

Hey there, thank you for your time and effort.

Are there any plans for a new release, as it has been 4 years since the latest release?

Dynamically copy Makefile.in.in

I was trying to compile pacman package, and it has multiple location of po files. It was complaining about missing lib/libalpm/po/Makefile.in.in. But you're only copying it to po/Makefile.in.in so I tried to create fix. It's first version so I'm open to ideas.

--- a/src/autopoint.in
+++ b/src/autopoint.in
@@ -18,8 +18,8 @@
 
 touch ./${dirprefix}/config.rpath ABOUT-NLS
 
-for i in intl/Makefile.in po/Makefile.in.in ; do
-	install -D -m 644 @datadir@/data/autopoint_Makefile.in "$i"
+for polocation in $(find -name POTFILES.in) ; do
+	install -D -m 644 @datadir@/data/autopoint_Makefile.in ./${polocation%/POTFILES.in}/Makefile.in.in
 done
 
 install -D -m 644 @datadir@/data/Makevars.template po/Makevars.template

As you can see above I disabled copying autopoint_Makefile.in to intl/Makefile.in and tried to compile some of packages that need gettext and everything worked. So I would like to ask why was intl/Makefile.in there ?

msgfmt aborts on long strings in non-Latin alphabets

Seen in the Dzongkha translation of GConf 3.2.6:

/bin/sh: line 1: 25453 Aborted                 /usr/bin/msgfmt -o $file dz.po

Further inspection:

(gdb) bt
#0  0x00003ffff7f9f768 in __syscall4 (d=8, c=0, b=70368744151424, a=2, n=174) at ./arch/powerpc64/syscall_arch.h:54
#1  __restore_sigs (set=0x3fffffff9980) at src/signal/block.c:43
#2  0x00003ffff7f9fa6c in raise (sig=<optimized out>) at src/signal/raise.c:13
#3  0x00003ffff7f6b8c4 in abort () at src/exit/abort.c:13
#4  0x0000000100004dfc in get_length_and_convert (info=0x3fffffff9d38, 
    x=0x3fffffff9e80 "རིམ་སྒྲག་སར་བར་ལུ་ འབྲི་བཏུབ་པའི་གནད་སྡུད་གཞི་རྟེན་མེདཔ་ལས་ ལྡེ་མིག"..., 
    end=0x3fffffffae78 "Unable to store a value at key '%s', as the configuration server has no writable databases. There are some common causes of this problem: 1) your configuration path file %s/path doesn't contain any da"..., 
    convbuf=0x3fffffffae78 "Unable to store a value at key '%s', as the configuration server has no writable databases. There are some common causes of this problem: 1) your configuration path file %s/path doesn't contain any da"..., convbuflen=16384)
    at src/poparser.c:75
#5  0x0000000100005438 in poparser_feed_line (p=0x3fffffff9d38, 
    line=0x3fffffff9e78 "msgstr \"རིམ་སྒྲག་སར་བར་ལུ་ འབྲི་བཏུབ་པའི་གནད་སྡུད་གཞི་རྟེན་མེདཔ་ལས་ ལྡེ", <incomplete sequence \340>..., buflen=4096)
    at src/poparser.c:198
#6  0x0000000100003340 in process (in=0x100020080, out=0x3ffff7ffc020) at src/msgfmt.c:443
#7  0x00000001000045b4 in main (argc=4, argv=0x3ffffffff028) at src/msgfmt.c:608

Going to frame 4, get_length_and_convert, we can see e is wrong:

(gdb) x/s e
0x3fffffffae76: <incomplete sequence \340>
(gdb) x/x e
0x3fffffffae76: 0xe0

Going up to frame 6, process, we can see that the reason is because the string was cut off in the middle:

(gdb) p sizeof(line)
$5 = 4096
(gdb) p lp
$7 = 0x3fffffff9e78 "msgstr \"རིམ་སྒྲག་སར་བར་ལུ་ འབྲི་བཏུབ་པའི་གནད་སྡུད་གཞི་རྟེན་མེདཔ་ལས་ ལྡེ", <incomplete sequence \340>...
(gdb) p lp+4092
$11 = 0x3fffffffae74 "\275\233", <incomplete sequence \340>

This is what we expect to see having a short read of the line; BD 9B E0 are the 4,093rd, 4,094th, and 4,095th bytes. The line in question is 4,279 bytes long.

A quick-and-dirty solution was to bump line to be an array 8,192 bytes long, and convbuf equally raised to 32,768 bytes long. I am not sure how much of the stack is used in other modules, so I am unsure if this limit is safe to use or not.

Assertion failure while building WeeChat 2.7

Assertion failed: *in (src/StringEscape.c: unescape: 78)
make[2]: *** [po/CMakeFiles/translations.dir/build.make:81: po/de.gmo] Aborted
make[2]: *** Deleting file 'po/de.gmo'
make[2]: Leaving directory '/usr/src/packages/user/weechat/src/weechat-2.7/build'

Backtrace:

Core was generated by `/usr/bin/msgfmt -o /usr/src/packages/user/weechat/src/weechat-2.7/build/po/de.g'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00003fffbb06e498 in __syscall4 (d=8, c=0, b=70368447356360, a=2, n=174) at ./arch/powerpc64/syscall_arch.h:54
54      ./arch/powerpc64/syscall_arch.h: No such file or directory.
(gdb) bt
#0  0x00003fffbb06e498 in __syscall4 (d=8, c=0, b=70368447356360, a=2, n=174) at ./arch/powerpc64/syscall_arch.h:54
#1  __restore_sigs (set=0x3fffee4eddc8) at src/signal/block.c:43
#2  0x00003fffbb06e7e8 in raise (sig=<optimized out>) at src/signal/raise.c:11
#3  0x00003fffbb025c58 in abort () at src/exit/abort.c:13
#4  0x00003fffbb025d6c in __assert_fail (expr=<optimized out>, file=<optimized out>, line=<optimized out>, func=<optimized out>) at src/exit/assert.c:8
#5  0x000000012aab1814 in unescape (in=<optimized out>, out=<optimized out>, outsize=<optimized out>) at src/StringEscape.c:126
#6  0x000000012aab0b54 in poparser_feed_line (p=0x3fffee4ee078, 
    in=0x3fffee4ee1a8 "msgid \"       -bar: add the help bar\\n   -refresh: refresh list of options, then whole screen (command: /window refresh)\\n        -up: move the selected line up by \\\"number\\\" lines\\n      -down: move "..., in_len=<optimized out>)
    at src/poparser.c:283
#7  0x000000012aaaf84c in process (in=0x3fffbb0e3520, out=0x3fffbb0e3020, strict=<optimized out>) at src/msgfmt.c:201
#8  0x000000012aaaeac8 in main (argc=<optimized out>, argv=<optimized out>) at src/msgfmt.c:422
(gdb) frame 6
#6  0x000000012aab0b54 in poparser_feed_line (p=0x3fffee4ee078, 
    in=0x3fffee4ee1a8 "msgid \"       -bar: add the help bar\\n   -refresh: refresh list of options, then whole screen (command: /window refresh)\\n        -up: move the selected line up by \\\"number\\\" lines\\n      -down: move "..., in_len=<optimized out>)
    at src/poparser.c:283
283     src/poparser.c: No such file or directory.

This seems to be caused by the line being longer than the statically-allocated buffer:

(gdb) printf "%s\n", in
msgid "       -bar: add the help bar\n   -refresh: refresh list of options, then whole screen (command: /window refresh)\n        -up: move the selected line up by \"number\" lines\n      -down: move the selected line down by \"number\" lines\n      -left: scroll the fset buffer by \"percent\" of width on the left\n     -right: scroll the fset buffer by \"percent\" of width on the right\n        -go: select a line by number, first line number is 0 (\"end\" to select the last line)\n    -toggle: toggle the boolean value\n       -add: add \"value\" (which can be a negative number) for integers and colors, set/append to value for other types (set for a negative value, append for a positive value)\n     -reset: reset the value of option\n     -unset: unset the option\n       -set: add the /set command in input to edit the value of option (move the cursor at the beginning of value)\n    -setnew: add the /set command in input to edit a new value for the option\n    -append: add the /set command to append something in the value of option (move the cursor at the end of value)\n      -mark: toggle mark\n    -format: switch to the next available format\n    -export: export the options and values displayed in a file (each line has format: \"/set name value\" or \"/unset name\")\n      -help: force writing of help on options in exported file (see /help fset.look.export_help_default)\n    -nohelp: do not write help on options in exported file (see /help fset.look.export_help_default)\n     filter: set a new filter to see only matching options (this filter can be used as input in fset buffer as well); allowed formats are:\n               *       show all options (no filter)\n               xxx     show only options with \"xxx\" in name\n               f:xxx   show only configuration file \"xxx\"\n               t:xxx   show only type \"xxx\" (bool/int/str/col)\n               d       show only changed options\n               d:xxx   show only changed options with \"xxx\" in name\n               d=xxx   show only changed options with \"xxx\" in value\n               d==xxx  show only changed options with exact value \"xxx\"\n               h=xxx   show only options with \"xxx\" in description (translated)\n               he=xxx  show only options with \"xxx\" in description (in English)\n               =xxx    show only options with \"xxx\" in value\n               ==xxx   show only options with exact value \"xxx\"\n               c:xxx   show only options matching the evaluated condition \"xxx\", using following variables: file, section, option, name, parent_name, type, type_en, type_short (bool/int/str/col), type_tiny (b/i/s/c), default_value, default_value_undef, value, quoted_value, value_undef, value_changed, parent_value, min, max, description, description2, description_en, description_en2, string_values\n\nThe lines with options are displayed using string evaluation (see /help eval for the format), with these options:\n  - fset.format.option1: first format for an option\n  - fset.format.option2: second format for an option\n\nThe following variables can be used in these options:\n  - option data, with color and padded by spaces on the right:\n    - ${file}: configuration file (for example \"weechat\" or \"irc\")\n    - ${section}: section\n    - ${option}: option name\n    - ${name}: full option name (file.section.option)\n    - ${parent_name}: parent option name\n    - ${type}: option type (translated)\n    - ${type_en}: option type (in English)\n    - ${type_short}: short option type (bool/int/str/col)\n    - ${type_tiny}: tiny option type (b/i/s/c)\n    - ${default_value}: option default value\n    - ${default_value_undef}: \"1\" if default value is null, otherwise \"0\"\n    - ${value}: option value\n    - ${value_undef}: \"1\" if value is null, otherwise \"0\"\n    - ${value_changed}: \"1\" if value is different from default value, otherwise \"0\"\n    - ${value2}: option value, with inherited value if null\n    - ${parent_value}: parent option value\n    - ${min}: min value\n    - ${max}: max value\n    - ${description}: option description (translated)\n    - ${description2}: option description (translated), \"(no description)\" (translated) if there's no description\n    - ${description_en}: option description (in English)\n    - ${description_en2}: option description (in English), \"(no description)\" if there's no description\n    - ${string_values}: string values allowed for set of an integer option using strings\n    - ${marked}: \"1\" if option is marked, otherwise \"0\"\n    - ${index}: index of option in list\n  - option data, with color but no spaces:\n    - same names prefixed by underscore, for example: ${_name}, ${_type}, ...\n  - option data, raw format (no colors/spaces):\n    - same names prefixed by two underscores, for example: ${__name}, ${__type}, ...\n  - option data, only spaces:\n    - same names prefixed with \"empty_\", for example: ${empty_name}, ${empty_type}\n  - other data:\n    - ${selected_line}: \"1\" if the line is selected, otherwise \"0\"\n    - ${newline}: insert a new line at point, so the option is displayed on multiple lines\n\nKeys and input to move in on fset buffer:\n  up                        move one line up\n  down                      move one line down\n  pgup                      move one page up\n  pgdn                      move one page down\n  alt-home          <<      move to first line\n  alt-end           >>      move to last line\n  F11               <       scroll horizontally on the left\n  F12               >       scroll horizontally on the right\n\nKeys and input to set options on fset buffer:\n  alt+space         t       toggle boolean value\n  alt+'-'           -       subtract 1 from value for integer/color, set value for other types\n  alt+'+'           +       add 1 to value for integer/color, append to value for other types\n  alt+f, alt+r      r       reset value\n  alt+f, alt+u      u       unset value\n  alt+enter         s       set value\n  alt+f, alt+n      n       set new value\n  alt+f, alt+a      a       append to value\n  alt+','           ,       mark/unmark option\n  shift+up                  move one line up and mark/unmark option\n  shift+down                mark/unmark option and move one line down\n                    m:xxx   mark options displayed that are matching filter \"xxx\" (any filter on option or value is allowed, see filters above)\n                    u:xxx   unmark options displayed that are matching filter \"xxx\" (any filter on option or value is allowed, see filters above)\n\nOther keys and input on fset buffer:\n  ctrl+L                    refresh options and whole screen (command: /fset -refresh)\n                    $       refresh options (keep marked options)\n                    $$      refresh options (unmark all options)\n  alt+p             p       toggle plugin description options (plugins.desc.*)\n  alt+v             v       toggle help bar\n                    s:x,y   sort options by fields x,y (see /help fset.look.sort)\n                    s:      reset sort to its default value (see /help fset.look.sort)\n                    w:xxx   export options in file \"xxx\"\n                    w-:xxx  export options in file \"xxx\" without help\n                    w+:xxx  export options in file \"xxx\" with help\n  ctrl+X            x       switch the format used to display options\n                    q       close fset buffer\n\nMouse actions on fset buffer:\n  wheel up/down                   move line up/down\n  left button                     move line here\n  right button                    toggle boolean (on/off) or edit the option value\n  right button + drag left/right  increase/decrease value for integer/color, set/append to value for other types\n  right button + drag up/down     mark/unmark multiple options\n\nNote: if input has one or more leading spaces, the following text is interpreted as a filter, without the spaces. For example \" q\" searches all options with \"q\" inside name while \"q\" closes the fset buffer.\n\nExamples:\n  show IRC options changed:\n    /fset d:irc.*\n  show all options with \"nicklist\
(gdb)

Is it possible to use dynamic allocation for reading lines?

msgfmt segfaults building git 2.19.1

to reproduce:

msgfmt --check --statistics -o ru.mo po/ru.po

resulting in:

Program received signal SIGSEGV, Segmentation fault.
0x000000000040273c in process (in=0x605340, out=0x7ffff7ffb020)
    at src/msgfmt.c:471
471                     d.strlist[i].trans->off += d.off + d.len[pe_msgid] + d.len[pe_plural] + d.len[pe_ctxt];
(gdb) p i
$1 = 1
(gdb) p d.strlist[i]
$2 = {str = {len = 0, off = 53980}, trans = 0x0}
(gdb) p d.strlist[i-1]
$3 = {str = {len = 0, off = 53980}, trans = 0x619480}

the trans pointer of the second item is NULL. interestingly the 2nd item seems identical to the first apart from the trans pointer. i guess it's from the empty msgid "" string right at the start of the file.

@xhebox do you have time to look into this ?

Copyright violation: gettext.html is not under MIT license

The gettext.html file, in Appendix C "Licenses", states that "This manual is free documentation. It is dually licensed under the GNU FDL and the GNU GPL."

It is therefore wrong to distribute it via github in a package whose LICENSE file is an MIT license.

Please change the LICENSE file, to clarify, or remove the gettext.html from the package.

You are of course welcome to point to the URL https://www.gnu.org/software/gettext/manual/ , where people can find the up-to-date documentation of GNU gettext.

Any updates on a new release?

Hey there, thanks for your time and effort.

I was wondering if there are any plans for a new release anytime soon?

reported error building "attr-git"

@selkfoster from dragora linux reports errors with latest git building "attr-git" (i suppose that means package attr using latest git checkout) : http://sprunge.us/dXYD

i can see several issues there:

  1. msgmerge --update --lang=es es.po attr.pot seems to write to stdout, which seems to be unexpected

  2. /bin/sh: msgconv: not found - it is not clear from where msgconv is called and what it's supposed to do and if we should ship it

TODO: fuzzing

as now gettext-tiny supports quite a lot or almost all features of .po files, we should run some stress-tests with afl-fuzz, paired with asan so out-of-bounds reads get caught. better we do that before a release so no CVEs get filed :)

bindtextdomain should never return error

after building libvirt, the python module fails to start because they check the return value of bindtextdomain and interrupt the python module initialization if it fails.
a glance at glibc source seems to indicate that the glibc impl. never fails, and it's possible to pass pathnames containing of more than a single slash as second argument.

Static linking with iconv

Is it must to enforce static linking with iconv ? What about to remove '-static' linking or to add
an option which controls this ( I can try to do this) ?

Thanks!

glib-2.78.1 complains about iconv and intl

Hey there,

I'm trying to build glib-2.78.1 using muon on a custom Linux distribution that uses gettext-tiny and is based on musl libc. I am receiving the following error:

err project /root/glib-2.78.1/subprojects/iconv not found
fallback ['iconv'] failed for 'iconv'
err required dependency ['iconv'] not found
/root/glib-2.78.1/meson.build:2081:25: error required dependency not found
2081 |    libiconv = dependency ('iconv')

I tried several iconv implementations from toybox and from Alpine, but that doesn't seem to be the issue.

If I remove the dependency from the meson.build file I get a missing intl error.

Any ideas?

Thanks for your time!

Error building git with gui support.

Running gettext-tiny 0.2.0 on CRUX, I'm 80% sure this is a gettext-tiny caused error:

    SUBDIR git-gui
GITGUI_VERSION = 0.21.GITGUI
    * new locations or Tcl/Tk interpreter
    MSGFMT po/pt_pt.msg     MSGFMT    po/ru.msg make[1]: *** [Makefile:252: po/pt_pt.msg] Error 127
    MSGFMT    po/ja.msg make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:252: po/ru.msg] Error 127
make[1]: *** [Makefile:252: po/ja.msg] Error 127
make: *** [Makefile:1797: all] Error 2
=======> ERROR: Building '/usr/src/pkg/pkg/git#2.14.2-1.pkg.tar.gz' failed

Missing utilities in gettext-tiny

I realise it's probably very rare for these utilities to be called, hence they were not added. However, there are a few packages that use these utilities:

  • msgcat
    Checked for by libbytesize, but never used; simple enough to remove.
  • msgfilter
    This one actually is used by libbytesize for their Serbian translation. Our workaround has been to remove the Serbian translation from the build system.
  • msgattrib
    Used by the gcompris educational suite for every translation. Since there is no native language, this package is actually unbuildable with gettext-tiny due to missing msgattrib.

I guess msgattrib would be the most important for Adélie, since the others we've been able to work around so far.

Ships lock.m4 with missing dependencies

m4/lock.m4 uses gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER but nothing provides that function. For some reason this is only causing problems when I build parted, maybe that function ends up being pulled into most builds?

Unsupported distdir target

The bundled Makefile.in.in, installed by gettext-tiny's autopoint, does not support the distdir and dist targets, needed by automake-based buildsystems to generate a release.

__stack_chk_fail_local on gettext-tiny (master/x86)

I just wanna let you know that the compilation of gettext-tiny from master fails on i586:

cc -o msgfmt src/msgfmt.o src/poparser.o src/StringEscape.o -s
/tools/lib32/gcc/i586-linux-musl/9.1.1/../../../../i586-linux-musl/bin/ld: src/msgfmt.o: in function process': msgfmt.c:(.text+0x59b): undefined reference to __stack_chk_fail_local'
/tools/lib32/gcc/i586-linux-musl/9.1.1/../../../../i586-linux-musl/bin/ld: src/msgfmt.o: in function set_file': msgfmt.c:(.text+0x6ba): undefined reference to __stack_chk_fail_local'
/tools/lib32/gcc/i586-linux-musl/9.1.1/../../../../i586-linux-musl/bin/ld: src/msgfmt.o: in function main': msgfmt.c:(.text.startup+0x85b): undefined reference to __stack_chk_fail_local'
/tools/lib32/gcc/i586-linux-musl/9.1.1/../../../../i586-linux-musl/bin/ld: src/poparser.o: in function poparser_feed_line': poparser.c:(.text+0x8e9): undefined reference to __stack_chk_fail_local'
collect2: error: ld returned 1 exit status
make: *** [Makefile:70: msgfmt] Error 1

Note: I have PIE and SSP enabled by default in the compiler, but it works without any problems under x86_64.

msgfmt should apparently sort the string table

the string offset table should be sorted with strcmp(the strings themselves can stay like they are, but the order in the offset table should be sorted).

from quick inspection this looks non-trivial to add with the existing malloc-free multi-pass design.
maybe the best option is to create a separate .mo sort tool that's run as a final step.

gl_TYPE_WINT_T_PREREQ is missing

Hi,
During building nano package I discovered, that gl_TYPE_WINT_T_PREREQ is missing, and therefore I'm unable to compile it. So I looked to gettext and copied block of code from it and it worked. Patch would look like this

--- a/m4/wint_t.m4
+++ b/m4/wint_t.m4
@@ -60,3 +60,15 @@
   fi
   AC_SUBST([GNULIB_OVERRIDES_WINT_T])
 ])
+
+dnl Prerequisites of the 'wint_t' override.
+AC_DEFUN([gl_TYPE_WINT_T_PREREQ],
+[
+  AC_CHECK_HEADERS_ONCE([crtdefs.h])
+  if test $ac_cv_header_crtdefs_h = yes; then
+    HAVE_CRTDEFS_H=1
+  else
+    HAVE_CRTDEFS_H=0
+  fi
+  AC_SUBST([HAVE_CRTDEFS_H])
+])

autopoint does not create `install` target, nor generate actual .mo build instructions

Generating procps' build system (./autogen.sh) with gettext-tiny's autopoint has left the build system unable to make install:

Making install in po
make[2]: Entering directory '/usr/src/packages/system/procps/src/procps-v3.3.15-7bb949bcba13c107fa0f45d2d0298b1ad6b6d6cc/po'
make[2]: *** No rule to make target 'install'.  Stop.
make[2]: Leaving directory '/usr/src/packages/system/procps/src/procps-v3.3.15-7bb949bcba13c107fa0f45d2d0298b1ad6b6d6cc/po'
make[1]: *** [Makefile:1841: install-recursive] Error 1

It seems to have generated three files in the po directory: Makefile, Makefile.in, and Makefile.in.in, all containing just:

all:
clean:
dist:
distclean:
.PHONY: all clean dist distclean

This also broke make check-recursive.

Can't autoreconf polkit-0.115 without nls.m4 in /usr/share/aclocal

With stock gettext-tiny, and the .m4 files in /usr/share/gettext-tiny/m4:

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
configure.ac:521: warning: AM_NLS is m4_require'd but not m4_defun'd
/usr/share/aclocal/intltool.m4:27: IT_PROG_INTLTOOL is expanded from...
configure.ac:521: the top level
configure.ac:521: warning: AM_NLS is m4_require'd but not m4_defun'd
buildutil/intltool.m4:27: IT_PROG_INTLTOOL is expanded from...
configure.ac:521: the top level
autoreconf: configure.ac: tracing
configure.ac:521: warning: AM_NLS is m4_require'd but not m4_defun'd
buildutil/intltool.m4:27: IT_PROG_INTLTOOL is expanded from...
configure.ac:521: the top level
autoreconf: configure.ac: adding subdirectory test/mocklibc to autoreconf
autoreconf: Entering directory `test/mocklibc'
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:11: installing './compile'
configure.ac:8: installing './missing'
src/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `test/mocklibc'
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'buildutil'.
libtoolize: copying file 'buildutil/libtool.m4'
libtoolize: copying file 'buildutil/ltoptions.m4'
libtoolize: copying file 'buildutil/ltsugar.m4'
libtoolize: copying file 'buildutil/ltversion.m4'
libtoolize: copying file 'buildutil/lt~obsolete.m4'
libtoolize: Consider adding '-I buildutil' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:521: warning: AM_NLS is m4_require'd but not m4_defun'd
/usr/share/aclocal/intltool.m4:27: IT_PROG_INTLTOOL is expanded from...
configure.ac:521: the top level
configure.ac:521: warning: AM_NLS is m4_require'd but not m4_defun'd
buildutil/intltool.m4:27: IT_PROG_INTLTOOL is expanded from...
configure.ac:521: the top level
configure.ac:521: warning: AM_NLS is m4_require'd but not m4_defun'd
buildutil/intltool.m4:27: IT_PROG_INTLTOOL is expanded from...
configure.ac:521: the top level
configure:19500: error: possibly undefined macro: AM_NLS
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

If I copy /usr/share/gettext-tiny/m4/nls.m4 to /usr/share/aclocal/nls.m4, it works correctly:

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: adding subdirectory test/mocklibc to autoreconf
autoreconf: Entering directory `test/mocklibc'
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:11: installing './compile'
configure.ac:8: installing './missing'
src/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `test/mocklibc'
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'buildutil'.
libtoolize: copying file 'buildutil/libtool.m4'
libtoolize: copying file 'buildutil/ltoptions.m4'
libtoolize: copying file 'buildutil/ltsugar.m4'
libtoolize: copying file 'buildutil/ltversion.m4'
libtoolize: copying file 'buildutil/lt~obsolete.m4'
libtoolize: Consider adding '-I buildutil' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:26: installing './compile'
configure.ac:5: installing './missing'
src/examples/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'

This is the first failure of this kind, in about 600 packages.

newpoparser: issue with vim-8.1.0327

I am testing the new po parser for all the packages in Dragora (dragora.org). There is a build issue while trying to compile vim, here is the relevant part of the build log:

cd xxd; CC="gcc" CFLAGS=" -g0 -Os -mtune=generic -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1" LDFLAGS="-Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE -s -L/usr/local/lib -Wl,--as-needed"
make -f Makefile
make[2]: Entering directory '/usr/src/qi/build/vim-8.1.0327/src/xxd'
gcc -g0 -Os -mtune=generic -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE -s -L/usr/local/lib -Wl,--as-needed -DUNIX -o xxd xxd.c
make[2]: Leaving directory '/usr/src/qi/build/vim-8.1.0327/src/xxd'
make[2]: Entering directory '/usr/src/qi/build/vim-8.1.0327/src/po'
OLD_PO_FILE_INPUT=yes msgfmt -v -o af.mo af.po
OLD_PO_FILE_INPUT=yes msgfmt -v -o ca.mo ca.po
Segmentation fault
make[2]: *** [Makefile:29: ca.mo] Error 139
make[2]: Leaving directory '/usr/src/qi/build/vim-8.1.0327/src/po'
make[1]: *** [Makefile:1971: languages] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.