From a45337672be6f32df2a598f3fdc03e3c0b8f53ac Mon Sep 17 00:00:00 2001 From: "Jesse R. Gorzinski" Date: Mon, 3 Sep 2018 10:29:54 +0300 Subject: [PATCH 1/3] Ticket #3927: fix compilation failure on IBM i. Don't use utimensat() on IBM i due to different timespec structures. Signed-off-by: Andrew Borodin --- configure.ac | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a0c88fb0e..30a71f509 100644 --- a/configure.ac +++ b/configure.ac @@ -233,9 +233,6 @@ AC_CHECK_FUNCS([\ realpath ]) -dnl utimensat is supported since glibc 2.6 and specified in POSIX.1-2008 -AC_CHECK_FUNCS([utimensat]) - dnl getpt is a GNU Extension (glibc 2.1.x) AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)]) AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)]) @@ -304,6 +301,16 @@ AC_EGREP_CPP([yes], AC_MSG_RESULT(no) ]) +dnl utimensat is supported since glibc 2.6 and specified in POSIX.1-2008 +dnl utimensat() causes different timespec structures to cause failures on IBM i +case $host_os in +*os400) + ;; +*) + AC_CHECK_FUNCS([utimensat]) + ;; +esac + dnl Check linux/fs.h for FICLONE to support BTRFS's file clone operation case $host_os in linux*) From 79e5cdad2f21e2e6e89a7652e6b7064a67241d8e Mon Sep 17 00:00:00 2001 From: "Jesse R. Gorzinski" Date: Tue, 4 Sep 2018 11:50:37 +0300 Subject: [PATCH 2/3] configure.ac: check of Perl, Pyhton and Ruby on IBM i. Signed-off-by: Andrew Borodin --- configure.ac | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 30a71f509..9680a694d 100644 --- a/configure.ac +++ b/configure.ac @@ -57,9 +57,7 @@ dnl ############################################################################ PKG_PROG_PKG_CONFIG AC_PROG_INSTALL AC_PROG_LN_S -AC_PATH_PROG([PERL], [perl], [/usr/bin/perl]) -AC_PATH_PROG([PYTHON], [python], [/usr/bin/python]) -AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby]) +dnl See also the "OS specific stuff" section below. dnl Check nroff and the options it supports AC_CHECK_PROG(HAVE_nroff, nroff, true, false) @@ -274,9 +272,21 @@ AM_GNU_GETTEXT_VERSION([0.18.1]) mc_I18N dnl ############################################################################ -dnl OS specific flags +dnl OS specific stuff dnl ############################################################################ +case $host_os in +*os400) + AC_PATH_PROG([PERL], [perl], [/QOpenSys/pkgs/bin/perl]) + AC_PATH_PROG([PYTHON], [python], [/QOpenSys/pkgs/bin/python2]) + AC_PATH_PROG([RUBY], [ruby], [/QOpenSys/pkgs/bin/ruby]) + ;; +*) + AC_PATH_PROG([PERL], [perl], [/usr/bin/perl]) + AC_PATH_PROG([PYTHON], [python], [/usr/bin/python]) + AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby]) +esac + case $host_os in aux*) # A/UX From 4da6ea8db3a14db5ac76a0d468290d46a857a1d4 Mon Sep 17 00:00:00 2001 From: "Jesse R. Gorzinski" Date: Tue, 4 Sep 2018 11:57:11 +0300 Subject: [PATCH 3/3] (feed_subshell): on IBM i, read(1) can return 0 for a non-closed fd. Signed-off-by: Andrew Borodin --- configure.ac | 5 +++++ src/subshell/common.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/configure.ac b/configure.ac index 9680a694d..cdf5a8b6c 100644 --- a/configure.ac +++ b/configure.ac @@ -321,6 +321,11 @@ case $host_os in ;; esac +case $host_os in +*os400) + AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd]) +esac + dnl Check linux/fs.h for FICLONE to support BTRFS's file clone operation case $host_os in linux*) diff --git a/src/subshell/common.c b/src/subshell/common.c index eca94311e..505fbe325 100644 --- a/src/subshell/common.c +++ b/src/subshell/common.c @@ -558,9 +558,14 @@ feed_subshell (int how, gboolean fail_on_error) if (bytes <= 0) { +#ifdef PTY_ZEROREAD + /* On IBM i, read(1) can return 0 for a non-closed fd */ + continue; +#else tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode); fprintf (stderr, "read (subshell_pty...): %s\r\n", unix_error_string (errno)); exit (EXIT_FAILURE); +#endif } if (how == VISIBLY)