Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build currently failing on AIX and OS/400 (IBM i) #4403

Open
johnsonjh opened this issue May 12, 2024 · 7 comments · May be fixed by #4404
Open

Build currently failing on AIX and OS/400 (IBM i) #4403

johnsonjh opened this issue May 12, 2024 · 7 comments · May be fixed by #4404

Comments

@johnsonjh
Copy link
Contributor

src/unix/fs.c: In function 'uv__fs_copyfile':
src/unix/fs.c:1321:14: error: incompatible types when assigning to type 'struct timespec' from type 'st_timespec_t' {aka 'struct st_timespec'}
 1321 |   times[0] = src_statsbuf.st_atim;
      |              ^~~~~~~~~~~~
src/unix/fs.c:1322:14: error: incompatible types when assigning to type 'struct timespec' from type 'st_timespec_t' {aka 'struct st_timespec'}
 1322 |   times[1] = src_statsbuf.st_mtim;
      |              ^~~~~~~~~~~~
  CC       src/unix/libuv_la-poll.lo
gmake[1]: *** [Makefile:2730: src/unix/libuv_la-fs.lo] Error 1
gmake[1]: *** Waiting for unfinished jobs....
@johnsonjh
Copy link
Contributor Author

johnsonjh commented May 12, 2024

AIX build is failing with the same error.

@johnsonjh johnsonjh changed the title Build currently failing on NetBSD 10 Build currently failing on NetBSD 10 and AIX (cross-compiled) May 12, 2024
@johnsonjh
Copy link
Contributor Author

johnsonjh commented May 12, 2024

Must be a change within the last 60 days or so, I haven't yet bisected it. Reverting my application CI build processes to use the last released libuv (1.48.0) is a successful workaround for now.

@johnsonjh
Copy link
Contributor Author

johnsonjh commented May 12, 2024

Did a git bisect, the bad commit is the one 3 days ago:

commit bf61390769068de603e6deec8e16623efcbe761a (HEAD -> v1.x, origin/v1.x, origin/HEAD)
Author: Juan José Arboleda <soyjuanarbol@gmail.com>                                     
Date:   Wed May 8 04:30:30 2024 -0500                                                   
                                                                                        
    linux,darwin: make `uv_fs_copyfile` behaves like `cp -r` (#4396)                    
                                                                                        
    This commit changes the timestamps in the file, the ownership and the               
    group.                                                                              
                                                                                        
    Fixes: https://github.com/libuv/libuv/issues/3125                                   
                                                                                        
    Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>                          

@johnsonjh johnsonjh changed the title Build currently failing on NetBSD 10 and AIX (cross-compiled) Build currently failing on NetBSD 10 and AIX May 12, 2024
@johnsonjh johnsonjh changed the title Build currently failing on NetBSD 10 and AIX Build currently failing on NetBSD and AIX May 12, 2024
@saghul
Copy link
Member

saghul commented May 12, 2024

Ping @juanarbol

@johnsonjh
Copy link
Contributor Author

johnsonjh commented May 12, 2024

I'll remove NetBSD from this issue for now, I think that was a local configuration error, so I will open a separate issue if needed when I have more information.

The AIX, the error messages are:

src/unix/fs.c: In function 'uv__fs_copyfile':
src/unix/fs.c:1321:14: error: incompatible types when assigning to type 'struct timespec' from type 'st_timespec_t' {aka 'struct st_timespec'}
 1321 |   times[0] = src_statsbuf.st_atim;
      |              ^~~~~~~~~~~~
src/unix/fs.c:1322:14: error: incompatible types when assigning to type 'struct timespec' from type 'st_timespec_t' {aka 'struct st_timespec'}
 1322 |   times[1] = src_statsbuf.st_mtim;
      |              ^~~~~~~~~~~~

I had a bit of time to look into the problem.

From the AIX stat.h header:

#if _XOPEN_SOURCE>=700                                                
#ifdef _ALL_SOURCE                                                    
        st_timespec_t st_atim;  /* Time of last access  */            
        st_timespec_t st_mtim;  /* Time of last data modification */  
        st_timespec_t st_ctim;  /* Time of last file status change */ 
#else                                                                 
        struct timespec st_atim;/* Time of last access  */            
        struct timespec st_mtim;/* Time of last data modification */  
        struct timespec st_ctim;/* Time of last file status change */ 
#endif                                                                
#else                                                                 
        time_t  st_atime;       /* Time of last access */             
        int     st_atime_n;                                           
        time_t  st_mtime;       /* Time of last data modification */  
        int     st_mtime_n;                                           
        time_t  st_ctime;       /* Time of last file status change */ 
        int     st_ctime_n;                                           
#endif                                                                

A quick check shows that _ALL_SOURCE is defined, and that configure will always define it unconditionally, although I am not an autoconf expert.

The following patch seems to be sufficient:

diff --git a/src/unix/fs.c b/src/unix/fs.c
index 0c6c585c..7a2ce054 100644
--- a/src/unix/fs.c
+++ b/src/unix/fs.c
@@ -1226,21 +1226,25 @@ static ssize_t uv__fs_write(uv_fs_t* req) {
   return r;
 }
 
 
 static ssize_t uv__fs_copyfile(uv_fs_t* req) {
   uv_fs_t fs_req;
   uv_file srcfd;
   uv_file dstfd;
   struct stat src_statsbuf;
   struct stat dst_statsbuf;
+#if defined(_AIX) && _XOPEN_SOURCE>=700 && defined(_ALL_SOURCE)
+  st_timespec_t times[2];
+#else
   struct timespec times[2];
+#endif
   int dst_flags;
   int result;
   int err;
   off_t bytes_to_send;
   off_t in_offset;
   off_t bytes_written;
   size_t bytes_chunk;
 
   dstfd = -1;
   err = 0;

@juanarbol @saghul

@johnsonjh johnsonjh changed the title Build currently failing on NetBSD and AIX Build currently failing on AIX May 12, 2024
@johnsonjh
Copy link
Contributor Author

johnsonjh commented May 12, 2024

I just tested on OS/400 (PASE for IBM i 7.5, GCC 10.5.0, powerpc-ibm-os400) - it was broken in the same way, so I've updated the title again. The patch above works there also.

@johnsonjh johnsonjh changed the title Build currently failing on AIX Build currently failing on AIX and OS/400 (IBM i) May 12, 2024
@johnsonjh johnsonjh linked a pull request May 12, 2024 that will close this issue
@juanarbol
Copy link
Contributor

Oopsie. I will be participating in #4404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants