Bug 208958 - net/rsync: fixing the ICONV option
Summary: net/rsync: fixing the ICONV option
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Emanuel Haupt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-21 14:50 UTC by Mathieu Arnold
Modified: 2016-04-23 13:15 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (ehaupt)


Attachments
patch (1.34 KB, patch)
2016-04-22 13:23 UTC, Mathieu Arnold
mat: maintainer-approval? (ehaupt)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Arnold freebsd_committer 2016-04-21 14:50:52 UTC
I don't exactly know when it stopped working, or if it ever worked on 10.x, but last week, I tried to use rsync with "--iconv=UTF-8,US-ASCII//IGNORE//TRANSLIT" (it translitterates letters like é to 'e to ß to ss if it can, and drop them if it cannot) to transfer files from a utf-8 host to a crappy old file server.

So, anyway, I updated my crappy old file server to 10.3, and that command stopped working, saying that the remote rsync did not support --iconv, so, I had a look and changed the :

.if empty(ICONV_LIB)
CONFIGURE_ARGS+=ac_cv_search_libiconv_open=no
.endif

to

.if ! ${PORT_OPTIONS:MICONV}
CONFIGURE_ARGS+=ac_cv_search_libiconv_open=no
.endif

rebuilt, and there, it had iconv support again, and I was happy and all.

But something else is fishy, today, net/rabbitmq failed to build in poudriere because:

Shared object "libiconv.so.2" not found, required by "rsync"

Some head scratching, and I found out that there only is a BUILD_DEPENDS on converters/libiconv, so, rsync is built with it, but depends is not registered, if I build it in poudriere testport -i, in the shell, I can remove libiconv because nothing depends on it, and then:

root@10amd64-ports:~ # pkg check -Ba
Checking all packages:  66%
(rsync-3.1.2_2) /usr/local/bin/rsync - required shared library libiconv.so.2 not found
Checking all packages: 100%
root@10amd64-ports:~ #

I'm not sure how to fix this, I'm tempted to change the ICONV_USES=iconv line in rsync's Makefile to ICONV_USES=iconv:translit, but I'm wondering if there's not some bug somewhere in Mk/Uses/iconv.mk's logic, and it should be fixed there.

(adding Tijl to the cc because he's the one who did the last change to iconv.mk)
Comment 1 Tijl Coosemans freebsd_committer 2016-04-21 20:16:26 UTC
There are two iconv(3) implementations, one in libc and one in converters/libiconv.  The one in libc does not support translit.  If you need that just change USES=iconv into USES=iconv:translit.  It will make the port use libiconv.  The port Makefile and Uses/iconv.mk are otherwise fine I think.
Comment 2 Mathieu Arnold freebsd_committer 2016-04-21 22:06:04 UTC
Well, I do think there is something strange, on 10.1, at least, it adds a build dependency on converters/libiconv, so rsync links with it, and then, the package doesn't register a runtime dependency, and the resulting rsync is not usable.
Comment 3 Tijl Coosemans freebsd_committer 2016-04-22 07:10:24 UTC
It links with libiconv because you modified the Makefile.  The build dependency is to get /usr/local/include/iconv.h because /usr/include/iconv.h still contains const qualifiers on 10.1.  See ports r384038.
Comment 4 Mathieu Arnold freebsd_committer 2016-04-22 07:13:52 UTC
Well, maybe, but before I modified it, it was not linking with any iconv library, at all, when the ICONV option was enabled.
Comment 5 Tijl Coosemans freebsd_committer 2016-04-22 08:41:06 UTC
That's because it uses the iconv(3) implementation in libc.  You probably got an error because this implementation does not support //IGNORE//TRANSLIT.
Comment 6 Tijl Coosemans freebsd_committer 2016-04-22 08:52:19 UTC
Actually, there is a bug in the Makefile, but it's not related to your problem.  It should be:

.if empty(ICONV_LIB) || ! ${PORT_OPTIONS:MICONV}
CONFIGURE_ARGS+=ac_cv_search_libiconv_open=no
.endif

This prevents linking with libiconv on FreeBSD 9 when the ICONV option is off.  The rsync configure script always adds -liconv if it finds the library.
Comment 7 Mathieu Arnold freebsd_committer 2016-04-22 09:08:41 UTC
Mmm, ok, with that, it looks more consistent, but one still can't use //TRANSLIT on 10, while it works on 9.
Comment 8 Tijl Coosemans freebsd_committer 2016-04-22 10:11:22 UTC
You can ask the maintainer to change USES=iconv into USES=iconv:translit.
Comment 9 Mathieu Arnold freebsd_committer 2016-04-22 13:23:32 UTC
Created attachment 169562 [details]
patch

So, add a patch
Comment 10 Emanuel Haupt freebsd_committer 2016-04-23 12:10:58 UTC
(In reply to Tijl Coosemans from comment #8)

I approve this patch. Please feel free to commit.
Comment 11 commit-hook freebsd_committer 2016-04-23 13:13:59 UTC
A commit references this bug:

Author: mat
Date: Sat Apr 23 13:13:12 UTC 2016
New revision: 413870
URL: https://svnweb.freebsd.org/changeset/ports/413870

Log:
  Fix ICONV support.

  PR:		208958
  Submitted by:	mat
  Reviewed by:	tijl
  Approved by:	maintainer
  Sponsored by:	Absolight

Changes:
  head/net/rsync/Makefile