aboutcode-org / aboutcode-org/source-inspector

xgettext: multiple starting lines for a string are not well supported

Offen
#13 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C
Sterne
3
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

In the current xgettext implementation I can see at line 115 https://github.com/nexB/source-inspector/blob/9511f56b44ac7c5644b34d413146d58dd9fa7ea0/src/source_inpector/strings_xgettext.py#L115 the following:

```
_, _, start_line = line.rpartition(":")
```

This is likely leading to the wrong results, as a line can have multiple instances of `start_line`, which you aren't catching. As an example, I used `xgettext` with the same parameters as you did on `libbb/lineedit.c` from BusyBox:

```
$ xgettext --omit-header --extract-all --no-wrap lineedit.c
```

Some of the result lines:

```
#: lineedit.c:834 lineedit.c:890 lineedit.c:893
msgid "."
msgstr ""
```

As you can see there are multiple file/line number entries there. It seems that at some point the authors of `xgettext` decided to combine these. Your code does not correctly process these lines:

```
>>> line = '#: lineedit.c:834 lineedit.c:890 lineedit.c:893'
>>> _, _, start_line = line.rpartition(":")
>>> start_line
'893'
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.