! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Macro dirfd() on IRIX 6.5
Status:
CLOSED: FIXED
Product:
Thunar-vfs
Component:
General

Comments

Description Daichi Kawahata 2005-11-30 13:53:09 CET
-D_BSD_SOURCE doesn't work to use dirfd(), while man page says

#include <sys/types.h>
#include <sys/dir.h>

are required, that causes another errors below

In file included from thunar-vfs-scandir.c:41:
/usr/include/dirent.h:56: error: conflicting types for 'DIR'
/usr/include/sys/dir.h:100: error: previous declaration of 'DIR' was here
/usr/include/dirent.h:63: error: conflicting types for 'BSDopendir'
/usr/include/sys/dir.h:121: error: previous declaration of 'BSDopendir' was here
/usr/include/dirent.h:64: error: conflicting types for 'BSDclosedir'
/usr/include/sys/dir.h:125: error: previous declaration of 'BSDclosedir' was here
/usr/include/dirent.h:65: error: conflicting types for 'BSDreaddir'
/usr/include/sys/dir.h:122: error: previous declaration of 'BSDreaddir' was here
/usr/include/dirent.h:66: error: syntax error before '(' token
/usr/include/dirent.h:69: error: conflicting types for 'BSDtelldir'
/usr/include/sys/dir.h:123: error: previous declaration of 'BSDtelldir' was here
/usr/include/dirent.h:70: error: conflicting types for 'BSDseekdir'
/usr/include/sys/dir.h:124: error: previous declaration of 'BSDseekdir' was here
/usr/include/dirent.h:80: error: conflicting types for 'BSDscandir'
/usr/include/sys/dir.h:127: error: previous declaration of 'BSDscandir' was here
/usr/include/dirent.h:81: error: conflicting types for 'BSDalphasort'
/usr/include/sys/dir.h:128: error: previous declaration of 'BSDalphasort' was here

therefore, it needed (but of course this is wrong place to modify)

In thunar-vfs-scandir.c at 40.
#include <dirent.h> -> #include <sys/dirent.h>

nonetheless, that brings an warning below

thunar-vfs-scandir.c: In function 'thunar_vfs_scandir_collect_slow':
thunar-vfs-scandir.c:292: warning: implicit declaration of function 'readdir_r'

and compiled Thunar crashes at startup

Thunar-ERROR **: file thunar-folder.c: line 546 (thunar_folder_get_for_file):
assertion failed: (GTK_OBJECT_FLOATING (folder))
aborting...
Trace/BPT/RangeErr/DivZero/Ovflow trap (core dumped)

I'm not sure this crash is related to do directory scanning, but I can
create another bug account if you want, and at first is there any way
to detect dirfd() at configure process? I can show related header files
(sys/dir.h, dirent.h, sys/dirent.h) to you.

Reproducible: Always
Steps to Reproduce:
1. 
2. 
3.
Comment 1 Benedikt Meurer editbugs 2005-11-30 14:40:22 CET
The crash on GTK_OBJECT_FLOATING() is a different issue (it looks like the macro
is broken on IRIX for some reason, as GtkObject's are always created with an
initial floating reference). Please open a separate bug report.

Concerning dirfd(): As said earlier, we really need dirfd() for the generic
scandir collector. If you could send me the header files, I could have a look at
them.
Comment 2 Daichi Kawahata 2005-11-30 15:31:15 CET
Created attachment 347 
Related header (1/4)

/usr/include/dirent.h
Comment 3 Daichi Kawahata 2005-11-30 15:31:59 CET
Created attachment 348 
Related header (2/4)

/usr/include/sys/dirent.h
Comment 4 Daichi Kawahata 2005-11-30 15:32:42 CET
Created attachment 349 
Related header (3/4)

/usr/include/sys/types.h
Comment 5 Daichi Kawahata 2005-11-30 15:33:19 CET
Created attachment 350 
Related header (4/4)

/usr/include/sys/dir.h
Comment 6 Benedikt Meurer editbugs 2005-11-30 15:40:57 CET
Ok, looks like SGI introduced two incompatible APIs here. What we need is
definetly <dirent.h> (which in turn includes <sys/dirent.h>), and this is
incompatible with <sys/dir.h>. You could try to add

#ifdef __sgi__
#define dirfd(dp) (((DIR *) dp)->__dd_fd)
#endif

to thunar-vfs-scandir.c, which should serve as a valid workaround. If that makes
it work, i'll commit it.
Comment 7 Daichi Kawahata 2005-11-30 16:00:57 CET
Worked, now only startup crash is my problem, thanks.
Comment 8 Benedikt Meurer editbugs 2005-11-30 16:48:05 CET
Committed with revision 18976.

Bug #1247

Reported by:
Daichi Kawahata
Reported on: 2005-11-30
Last modified on: 2010-11-07

People

Assignee:
Jannis Pohlmann
CC List:
1 user

Version

Version:
unspecified

Attachments

Related header (1/4) (3.02 KB, text/plain)
2005-11-30 15:31 CET , Daichi Kawahata
no flags
Related header (2/4) (2.76 KB, text/plain)
2005-11-30 15:31 CET , Daichi Kawahata
no flags
Related header (3/4) (15.39 KB, text/plain)
2005-11-30 15:32 CET , Daichi Kawahata
no flags
Related header (4/4) (4.14 KB, text/plain)
2005-11-30 15:33 CET , Daichi Kawahata
no flags

Additional information