GNOME Bugzilla – Bug 689075
glib incorrectly assumes that all character device files are seekable
Last modified: 2018-05-24 14:52:11 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.
-- 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.