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 759346 - vte calls posix_openpt with invalid arguments
vte calls posix_openpt with invalid arguments
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
git master
Other FreeBSD
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-12-11 12:30 UTC by Ting-Wei Lan
Modified: 2015-12-14 18:07 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ting-Wei Lan 2015-12-11 12:30:47 UTC
In src/pty.cc, function _vte_pty_open_posix, posix_openpt is always called with O_RDWR, O_NOCTTY, O_NONBLOCK, but POSIX standard only allows O_RDWR and O_NOCTTY. This causes the call to fail on FreeBSD because an invalid flag (O_NONBLOCK) is used.

I think most *BSD support posix_openpt, as we can find in man pages:
https://www.freebsd.org/cgi/man.cgi?query=posix_openpt&sektion=2&format=html
https://www.dragonflybsd.org/cgi/web-man?command=posix_openpt&section=3
https://man.netbsd.org/7.0/usr/share/man/html3/posix_openpt.html
http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/posix_openpt.3

This means vte uses posix_openpt instead of openpty on *BSD.


Hurd has a non-working posix_openpt function that returns 'function not implemented', so I think openpty support is still needed although the check in configure.ac may need to be modified to work on Hurd.
Comment 1 Christian Persch 2015-12-12 16:27:44 UTC
According to bug 670758, at least openbsd doesn't/didn't implement posix_openpt. If that's not try anymore, and all the still-developed BSDs work with the posix_openpt path, we should remove the openpty() path.

I added a fallback to apply the NONBLOCK afterwards if posix_openpt with it fails with EINVAL. Can you please check if master now works for you?
Comment 2 Antoine Jacoutot 2015-12-12 18:32:07 UTC
(In reply to Christian Persch from comment #1)
> According to bug 670758, at least openbsd doesn't/didn't implement
> posix_openpt. If that's not try anymore, and all the still-developed BSDs
> work with the posix_openpt path, we should remove the openpty() path.

Since then, posix_openpt(3) has been implemented in OpenBSD fwiw.
Comment 3 Ting-Wei Lan 2015-12-13 14:35:40 UTC
I can run vte-2.91 now, but it shows 'JITing regex failed: bad JIT option' when searching text. I have pcre2 10.20 installed.
Comment 4 Christian Persch 2015-12-13 18:09:58 UTC
That's because your pcre2 doesn't support JIT. I've silenced this warning now.

I removed the openpty codepath, would be good if everyone could test their BSD variant to verify :-)
Comment 5 Ting-Wei Lan 2015-12-14 00:46:31 UTC
--enable-jit is used when running configure for pcre2. Are there other options required?
Comment 6 Christian Persch 2015-12-14 09:32:21 UTC
That should be sufficient. What does 
$ pcre2test -C
say about Just-in-time compiler support?
Comment 7 Ting-Wei Lan 2015-12-14 18:07:50 UTC
I found I had pcre2 installed by jhbuild, which didn't enable JIT.

After running 'jhbuild uninstall pcre2', vte-2.91 uses pcre2 installed from FreeBSD ports and the warning is fixed now.