Tcl Source Code

View Ticket
Login
Ticket UUID: 1001325
Title: readdir_r() is different on IRIX 5.3
Type: Bug Version: obsolete: 8.4.7
Submitter: nobody Created on: 2004-07-31 22:55:41
Subsystem: 49. Threading Assigned To: dgp
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2004-12-02 08:17:56
Resolution: Fixed Closed By: dgp
    Closed on: 2004-12-02 01:17:56
Description:
When compiling tcl 8.4.7 on IRIX 5.3 with --enable-threads one ends up with
cfe: Error: ./../unix/tclUnixThrd.c, line 837: The number of arguments doesn't agree with the number in the declaration.
     if (readdir_r (dir, ent, &ent) != 0) {
 ------------------^
*** Error code 1 (bu21)

This is because on IRIX 5.3 readdir_r() is

 struct dirent *readdir_r (DIR *dirp, struct dirent *res);

unix/tclUnixThrd.c thushas to be changed on IRIX 5.3 into

#ifdef HAVE_READDIR_R
    ent = &tsdPtr->rdbuf.ent;
/*    if (TclOSreaddir_r(dir, ent, &ent) != 0) {
        ent = NULL;
    }
*/
        ent=TclOSreaddir_r(dir, ent);

#else /* !HAVE_READDIR_R */

ideally the configure tools should detect which version of readdir_r is being used on a given platform.
User Comments: dgp added on 2004-12-02 08:17:56:
Logged In: YES 
user_id=80530

unless someone says
otherwise, I believe this is fixed
for Tcl 8.4.9.

jenglish''s suggestion is a
good one to explore in 8.5 development.

jenglish added on 2004-11-30 00:45:18:
Logged In: YES 
user_id=68433

A suggestion: don't  use readdir_r() at all, unless it can
be demonstrated that readdir() is in fact broken on the host
platform.

On most systems (including IRIX 5.3 AFAICT), readdir() is
perfectly thread-safe as long as you don't share the same
DIR * across multiple threads (which Tcl doesn't do).

dgp added on 2004-11-29 22:58:04:
Logged In: YES 
user_id=80530


It would be best for someone with
and IRIX 5.3 system to say for sure.

kennykb added on 2004-11-29 22:55:39:
Logged In: YES 
user_id=99768

I see that you closed 1071701 - is this bug now fixed also?

dgp added on 2004-11-25 05:00:38:
Logged In: YES 
user_id=80530

See 1071701.  Things are
still broken.

kennykb added on 2004-11-25 03:22:45:
Logged In: YES 
user_id=99768

Correction applied to both HEAD and 8.4 branch

dgp added on 2004-11-25 01:41:56:

File Added - 109995: autoconf.patch

Logged In: YES 
user_id=80530

new patch includes
outcome of running
autoconf-2.13.

kennykb added on 2004-11-25 01:13:51:

File Added - 109993: 1001325.patch

kennykb added on 2004-11-25 01:13:50:
Logged In: YES 
user_id=99768

Mo's change breaks an ordinary Linux-IA32 build, because NULL
is undefined unless <stdlib.h> is included.  Don, could you
rerun
autoconf with the attached 1001325.patch? (I don't have 2.13 to
and at the moment.)

gschwarz added on 2004-11-18 06:40:01:
Logged In: YES 
user_id=951222

I've applied that patch to 8.4.7, and it now compiles on IRIX 
5.3.

mdejong added on 2004-09-24 13:17:00:

File Added - 102636: readdir_r.patch

Logged In: YES 
user_id=90858

Could someone with an IRIX 5.3 system try this patch? It should
detect the 2 or 3 arg version of readdir_r, but it has had
no testing.

Attachments: