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 689075 - glib incorrectly assumes that all character device files are seekable
glib incorrectly assumes that all character device files are seekable
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
2.30.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-11-26 11:45 UTC by spiiroin
Modified: 2018-05-24 14:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description spiiroin 2012-11-26 11:45:09 UTC
The g_io_channel_new_file() and g_io_channel_unix_new() functions
set is_seekable flag for all character device files

glib2.0-2.30.0 % grep -nC1 -eis_seekable glib/giounix.c 
554-
555:  channel->is_seekable = S_ISREG (buffer.st_mode) || S_ISCHR (buffer.st_mode)
556-                         || S_ISBLK (buffer.st_mode);
--
632-  if (fstat (unix_channel->fd, &buffer) == 0)
633:    channel->is_seekable = S_ISREG (buffer.st_mode) || S_ISCHR (buffer.st_mode)
634-                           || S_ISBLK (buffer.st_mode);
635-  else /* Assume not seekable */
636:    channel->is_seekable = FALSE;
637-

And g_io_channel_get_flags() returns G_IO_FLAG_IS_SEEKABLE based on that

glib2.0-2.30.0 % grep -nC1 -e[^@]G_IO_FLAG_IS_SEEKABLE glib/giochannel.c 
1012-  if (channel->is_seekable)
1013:    flags |= G_IO_FLAG_IS_SEEKABLE;
1014-  if (channel->is_readable)

Now for example /dev/ttyX and /dev/input/eventX channels have the
G_IO_FLAG_IS_SEEKABLE flag, but calls to g_io_channel_seek_position()
will fail.
Comment 1 GNOME Infrastructure Team 2018-05-24 14:52:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/637.