After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 152020 - Use absolute paths to iconv and gettext
Use absolute paths to iconv and gettext
Status: RESOLVED FIXED
Product: intltool
Classification: Deprecated
Component: general
unspecified
Other All
: High enhancement
: ---
Assigned To: intltool maintainers
intltool maintainers
Depends on:
Blocks:
 
 
Reported: 2004-09-06 22:39 UTC by Julio Merino
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Proposed patch (5.81 KB, patch)
2004-09-06 22:40 UTC, Julio Merino
none Details | Review
Patch with env variables (6.24 KB, patch)
2004-09-08 11:05 UTC, Julio Merino
none Details | Review
Updated patch to fix issues (6.89 KB, patch)
2004-09-28 17:16 UTC, Rodney Dawes
none Details | Review

Description Julio Merino 2004-09-06 22:39:27 UTC
intltool uses iconv and gettext (msgfmt, msgmerge and xgettext) at run time.  To
run these, it uses the shell's which command, which relies on the path to find
them.  IMHO, this approach is wrong, as it can cause some problems.  Let me
describe them.

Given that all these utilities are dependencies of intltool, they can be looked
for at configuration time (just like it actually does for perl).  And, once
found, their path can be hardcoded in the generated scripts.  This way intltool
will _always_ run the same utilities, no matter what the path is for a given user.

But where are the problems?  Consider a system with multiple versions of gettext
installed.  For example, it could be NetBSD, which comes with GNU gettext in the
packages collection and with a BSD replacement in the base system.  Sometimes,
the gettext in the base system causes compatibility problems, so the one from
the packages collection has to be used.

With the current situation, a user may install intltool in the system and use it
with his path preferring the GNU gettext; he will get no problems.  But if a
user tries to run it with his path pointing to the other gettext by default,
intltool will misteriously fail.  Having the absolute path hardcoded in it could
have avoided this problem.

Note that this problem is hypotetical in NetBSD, although I have hit it with
other packages (not intltool).  However, it may perfectly happen on other
systems, or in a future if GNU-specific functionality is used.  Therefore, I
think that fixing this issue ASAP will improve future packages.

IMHO, I think that this is a problem.  However you may perfectly disagree.  In
such case, I may try to convince you, or you can simply close this bug...
Comment 1 Julio Merino 2004-09-06 22:40:01 UTC
Created attachment 31344 [details] [review]
Proposed patch
Comment 2 Kenneth Rohde Christiansen 2004-09-07 22:44:31 UTC
Patch looks fine, but you always have to add a ChangeLog entry. Can people
confirm that intltool still works after applying this patch? If so, it can be
committed.
Comment 3 Rodney Dawes 2004-09-08 02:28:51 UTC
I'm not sure this is the correct fix. It is possible that one app will need a
different version of gettext than another app, and so being able to point at
different prefixes is quite useful. I don't think we should hardcode paths. If
we require specific options that only exist in GNU gettext, perhaps we should
check to make sure that we are using GNU gettext.
Comment 4 Danilo Segan 2004-09-08 08:25:44 UTC
I agree with Rodney. We might want to use the approach we already use for some
of the stuff (eg. my $iconv = $ENV{"INTLTOOL_ICONV"} || "@INTLTOOL_ICONV@";) for
everything, including gettext functions.

So, introduce $MSGMERGE and $MSGFMT as well ($XGETTEXT is already correctly set
based on environment variable XGETTEXT).
Comment 5 Julio Merino 2004-09-08 11:05:17 UTC
Created attachment 31409 [details] [review]
Patch with env variables

Let's see how this looks.  This new patch is the same as the previous one, but
recognizes the $MSGFMT and $MSGMERGE environment variables; these can be used
to override the paths hardcoded in intltool, in case that it's necessary.
Comment 6 Rodney Dawes 2004-09-24 17:51:07 UTC
I have a few issues with this patch, but they are easily fixable. There are
various inconsistencies with variable names and such. If the MSGFMT and MSGMERGE
env vars are going to not have INTLTOOL_ prefixed, then so should ICONV. And if
we're going to allow setting the env vars, we should for XGETTEXT also. It seems
like one would want to use the same version of xgettext as msgfmt and msgmerge.
Also, the sed rule for @INTLTOOL_EXTRACT@ should use $(bindir) instead of
${exec_prefix}/bin. It gets properly expanded in the shell anyway.

The general idea behind the patch seems ok though.
Comment 7 Danilo Segan 2004-09-24 18:10:36 UTC
Rodney, we're already using XGETTEXT environment variable (look around line 586
in intltool-update.in.in), like I said in comment #4.

On the topic of variable names, I agree, though I didn't want to insist on it
right away.
Comment 8 Danilo Segan 2004-09-24 18:12:30 UTC
Btw, I suppose it's a good idea to have this documented in a README in a section
titled eg. "Modifying intltool behaviour with environment variables". Anyone
looking forward to doing that? ;-)
Comment 9 Rodney Dawes 2004-09-24 18:14:45 UTC
Ah. But the code is inconsistent. We should fix that up to be consistent with
the rest of the env var usages then. It looks weird. :)
Comment 10 Danilo Segan 2004-09-24 18:21:02 UTC
Yes, indeed. "Inconsistent" is even a bit too soft: "messy" might be even more
appropriate ;-)
Comment 11 Julio Merino 2004-09-26 10:27:16 UTC
Hmm yes, at first I thought that having INTLTOOL_ prepended to all those
variables could be good.  Maybe I didn't do it because some of the existing
variables didn't have it (XGETTEXT, IIRC).  So what'd be the best way to go? 
Name all the variables INTLTOOL_*?
Comment 12 Danilo Segan 2004-09-26 11:06:27 UTC
Note that replacing XGETTEXT with INTLTOOL_XGETTEXT might mean incompatible
change (though not very visible one, since I suspect not many users are relying
on XGETTEXT being used).
Comment 13 Rodney Dawes 2004-09-28 14:24:08 UTC
I think we should replace INTLTOOL_ICONV with plain ICONV and check for both,
falling back to whatever we find at configure time, and keep all the gettext
variables without the INTLTOOL_ prefix.
Comment 14 Rodney Dawes 2004-09-28 17:16:49 UTC
Created attachment 32028 [details] [review]
Updated patch to fix issues

Here is an updated version of the patch, that fixes the issues I mentioned. If
nobody complains, I'm going to commit this and do a release. Danilo? :)
Comment 15 Danilo Segan 2004-09-28 18:33:18 UTC
Looks good, go ahead ;-)
Comment 16 Rodney Dawes 2004-09-29 16:48:44 UTC
Committed and made a release with the few important bug fixes.