Pino Toscano
2014-Nov-06 16:23 UTC
[Libguestfs] [PATCH 0/2] hivex: small portability fixes
Hi, this small series cherry-picks a couple of the portability fixes recently done in libguestfs to hivex. There should be no actual change on Linux. Thanks, -- Pino Pino Toscano (2): normalize iconv handling ruby: fix detection of ruby library bootstrap | 1 + configure.ac | 8 +++++++- lib/utf16.c | 3 +-- 3 files changed, 9 insertions(+), 3 deletions(-) -- 1.9.3
Since the signature of iconv() changes between implementations (the
constness of the second parameter, in particular), make use of the iconv
module of gnulib to handle these potential differences.
(This is a reduced version of 57512e778558c5b93cfa360c83836c2cf8fc5908
in libguestfs.)
---
bootstrap | 1 +
lib/utf16.c | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bootstrap b/bootstrap
index b2960c1..bd82477 100755
--- a/bootstrap
+++ b/bootstrap
@@ -63,6 +63,7 @@ full-write
gitlog-to-changelog
gnu-make
gnumakefile
+iconv
ignore-value
inttypes
maintainer-makefile
diff --git a/lib/utf16.c b/lib/utf16.c
index 7d275fd..fe2c3bd 100644
--- a/lib/utf16.c
+++ b/lib/utf16.c
@@ -54,8 +54,7 @@ _hivex_recode (const char *input_encoding, const char *input,
size_t input_len,
const char *inp = input;
char *outp = out;
- /* Surely iconv doesn't really modify the input buffer? XXX */
- size_t r = iconv (ic, (char **) &inp, &inlen, &outp,
&outlen);
+ size_t r = iconv (ic, (ICONV_CONST char **) &inp, &inlen, &outp,
&outlen);
if (r == (size_t) -1) {
if (errno == E2BIG) {
int err = errno;
--
1.9.3
Pino Toscano
2014-Nov-06 16:23 UTC
[Libguestfs] [PATCH 2/2] ruby: fix detection of ruby library
Query RbConfig::CONFIG for "libdir", and use that when trying to link
to
the ruby library. This fixes the libruby detection when it is installed
in a non-standard library directory.
(This is the same change as 3d02e53c48266669675cc237f61ae2c4e1816e66
in libguestfs.)
---
configure.ac | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 3d85afe..554ff87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -376,9 +376,15 @@ AS_IF([test "x$enable_ruby" != "xno"],[
libruby="$(cat conftest)"
rm conftest
AS_IF([test -n "$libruby"],[
+ ruby_cmd='puts
RbConfig::CONFIG@<:@"libdir"@:>@'
+ echo running: $RUBY -rrbconfig -e \'$ruby_cmd\'
>&AS_MESSAGE_LOG_FD
+ $RUBY -rrbconfig -e "$ruby_cmd" >conftest
2>&AS_MESSAGE_LOG_FD
+ libruby_libdir="$(cat conftest)"
+ rm conftest
+ test -n "$libruby_libdir" &&
libruby_libdir="-L$libruby_libdir"
AC_MSG_RESULT([-l$libruby])
AC_CHECK_LIB([$libruby],[ruby_init],
- [have_libruby=1],[have_libruby=])
+ [have_libruby=1],[have_libruby=],[$libruby_libdir])
dnl Symbols that we substitute when missing.
AS_IF([test -n "$have_libruby"],[
--
1.9.3
Richard W.M. Jones
2014-Nov-06 16:55 UTC
Re: [Libguestfs] [PATCH 2/2] ruby: fix detection of ruby library
On Thu, Nov 06, 2014 at 05:23:43PM +0100, Pino Toscano wrote:> Query RbConfig::CONFIG for "libdir", and use that when trying to link to > the ruby library. This fixes the libruby detection when it is installed > in a non-standard library directory. > > (This is the same change as 3d02e53c48266669675cc237f61ae2c4e1816e66 > in libguestfs.) > --- > configure.ac | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index 3d85afe..554ff87 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -376,9 +376,15 @@ AS_IF([test "x$enable_ruby" != "xno"],[ > libruby="$(cat conftest)" > rm conftest > AS_IF([test -n "$libruby"],[ > + ruby_cmd='puts RbConfig::CONFIG@<:@"libdir"@:>@' > + echo running: $RUBY -rrbconfig -e \'$ruby_cmd\' >&AS_MESSAGE_LOG_FD > + $RUBY -rrbconfig -e "$ruby_cmd" >conftest 2>&AS_MESSAGE_LOG_FD > + libruby_libdir="$(cat conftest)" > + rm conftest > + test -n "$libruby_libdir" && libruby_libdir="-L$libruby_libdir" > AC_MSG_RESULT([-l$libruby]) > AC_CHECK_LIB([$libruby],[ruby_init], > - [have_libruby=1],[have_libruby=]) > + [have_libruby=1],[have_libruby=],[$libruby_libdir]) > > dnl Symbols that we substitute when missing. > AS_IF([test -n "$have_libruby"],[ACK both. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Seemingly Similar Threads
- [PATCH 0/2] hivex: small portability fixes
- [PATCH] let the user explicitly choose ruby and rake programs
- [PATCH] hivex: Fix Ruby bindings for 1.9; let the user explicitly choose ruby, rake
- [PATCH libguestfs 0/3] Fix configure script detection of Ruby.
- [PATCH] configure: Move language binding detection to separate files.