Merge pull request #131937 from Luflosi/fix-squashfsTools-darwin

squashfsTools: make Darwin patch apply again

authored by

Sandro and committed by
GitHub
be071b1c b1064ace

+28 -28
+28 -28
pkgs/tools/filesystems/squashfs/darwin.patch
··· 8 index 4b06ccb..3cad2ab 100644 9 --- a/squashfs-tools/action.c 10 +++ b/squashfs-tools/action.c 11 - @@ -38,6 +38,10 @@ 12 - #include <limits.h> 13 #include <errno.h> 14 15 +#ifndef FNM_EXTMATCH /* glibc extension */ 16 + #define FNM_EXTMATCH 0 ··· 19 #include "squashfs_fs.h" 20 #include "mksquashfs.h" 21 #include "action.h" 22 - @@ -2284,9 +2288,12 @@ static char *get_start(char *s, int n) 23 24 static int subpathname_fn(struct atom *atom, struct action_data *action_data) 25 { ··· 27 + char *path = strdup(action_data->subpath); 28 + int is_match = fnmatch(atom->argv[0], get_start(path, 29 count_components(atom->argv[0])), 30 - FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0; 31 + free(path); 32 + return is_match; 33 } ··· 116 +#endif 117 118 #ifndef linux 119 - #define __BYTE_ORDER BYTE_ORDER 120 - @@ -4348,6 +4356,7 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq, 121 sigemptyset(&sigmask); 122 sigaddset(&sigmask, SIGQUIT); 123 sigaddset(&sigmask, SIGHUP); ··· 125 if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) != 0) 126 BAD_ERROR("Failed to set signal mask in intialise_threads\n"); 127 128 - @@ -5195,6 +5204,35 @@ int get_physical_memory() 129 long long page_size = sysconf(_SC_PAGESIZE); 130 int phys_mem; 131 ··· 161 if(num_pages == -1 || page_size == -1) { 162 struct sysinfo sys; 163 int res = sysinfo(&sys); 164 - @@ -5207,6 +5245,7 @@ int get_physical_memory() 165 } 166 167 phys_mem = num_pages * page_size >> 20; ··· 173 index 4debedf..3257c30 100644 174 --- a/squashfs-tools/read_xattrs.c 175 +++ b/squashfs-tools/read_xattrs.c 176 - @@ -39,13 +39,13 @@ 177 - #include <endian.h> 178 - #endif 179 180 +#include <stdlib.h> 181 + ··· 206 #include <sys/types.h> 207 #include <sys/time.h> 208 #include <sys/resource.h> 209 - @@ -1080,7 +1084,7 @@ int create_inode(char *pathname, struct inode *i) 210 break; 211 case SQUASHFS_SYMLINK_TYPE: 212 case SQUASHFS_LSYMLINK_TYPE: { ··· 215 { i->time, 0 }, 216 { i->time, 0 } 217 }; 218 - @@ -1099,8 +1103,7 @@ int create_inode(char *pathname, struct inode *i) 219 goto failed; 220 } 221 ··· 223 - AT_SYMLINK_NOFOLLOW); 224 + res = lutimes(pathname, times); 225 if(res == -1) { 226 - EXIT_UNSQUASH_STRICT("create_inode: failed to set time on " 227 - "%s, because %s\n", pathname, 228 - @@ -2235,6 +2238,7 @@ void initialise_threads(int fragment_buffer_size, int data_buffer_size) 229 - sigemptyset(&sigmask); 230 - sigaddset(&sigmask, SIGQUIT); 231 - sigaddset(&sigmask, SIGHUP); 232 - + sigaddset(&sigmask, SIGALRM); 233 - if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) != 0) 234 - EXIT_UNSQUASH("Failed to set signal mask in initialise_threads" 235 - "\n"); 236 diff --git a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h 237 index 934618b..0e680ab 100644 238 --- a/squashfs-tools/unsquashfs.h ··· 245 + #define FNM_EXTMATCH 0 246 +#endif 247 + 248 - #ifndef linux 249 - #define __BYTE_ORDER BYTE_ORDER 250 - #define __BIG_ENDIAN BIG_ENDIAN 251 diff --git a/squashfs-tools/unsquashfs_info.c b/squashfs-tools/unsquashfs_info.c 252 index c8e2b9b..7d4f7af 100644 253 --- a/squashfs-tools/unsquashfs_info.c 254 +++ b/squashfs-tools/unsquashfs_info.c 255 - @@ -97,31 +97,22 @@ void dump_state() 256 void *info_thrd(void *arg) 257 { 258 sigset_t sigmask; ··· 289 "because %s\n", strerror(errno)); 290 } 291 } 292 - @@ -133,8 +124,12 @@ void *info_thrd(void *arg) 293 /* set one second interval period, if ^\ received 294 within then, dump queue and cache status */ 295 waiting = 1;
··· 8 index 4b06ccb..3cad2ab 100644 9 --- a/squashfs-tools/action.c 10 +++ b/squashfs-tools/action.c 11 + @@ -39,6 +39,10 @@ 12 #include <errno.h> 13 + #include <ctype.h> 14 15 +#ifndef FNM_EXTMATCH /* glibc extension */ 16 + #define FNM_EXTMATCH 0 ··· 19 #include "squashfs_fs.h" 20 #include "mksquashfs.h" 21 #include "action.h" 22 + @@ -2414,9 +2418,12 @@ static char *get_start(char *s, int n) 23 24 static int subpathname_fn(struct atom *atom, struct action_data *action_data) 25 { ··· 27 + char *path = strdup(action_data->subpath); 28 + int is_match = fnmatch(atom->argv[0], get_start(path, 29 count_components(atom->argv[0])), 30 + FNM_PATHNAME|FNM_EXTMATCH) == 0; 31 + free(path); 32 + return is_match; 33 } ··· 116 +#endif 117 118 #ifndef linux 119 + #include <sys/sysctl.h> 120 + @@ -5022,6 +5030,7 @@ static void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq, 121 sigemptyset(&sigmask); 122 sigaddset(&sigmask, SIGQUIT); 123 sigaddset(&sigmask, SIGHUP); ··· 125 if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) != 0) 126 BAD_ERROR("Failed to set signal mask in intialise_threads\n"); 127 128 + @@ -5760,6 +5769,35 @@ static int get_physical_memory() 129 long long page_size = sysconf(_SC_PAGESIZE); 130 int phys_mem; 131 ··· 161 if(num_pages == -1 || page_size == -1) { 162 struct sysinfo sys; 163 int res = sysinfo(&sys); 164 + @@ -5772,6 +5810,7 @@ static int get_physical_memory() 165 } 166 167 phys_mem = num_pages * page_size >> 20; ··· 173 index 4debedf..3257c30 100644 174 --- a/squashfs-tools/read_xattrs.c 175 +++ b/squashfs-tools/read_xattrs.c 176 + @@ -31,13 +31,13 @@ 177 + #include <stdio.h> 178 + #include <string.h> 179 180 +#include <stdlib.h> 181 + ··· 206 #include <sys/types.h> 207 #include <sys/time.h> 208 #include <sys/resource.h> 209 + @@ -1175,7 +1179,7 @@ int create_inode(char *pathname, struct inode *i) 210 break; 211 case SQUASHFS_SYMLINK_TYPE: 212 case SQUASHFS_LSYMLINK_TYPE: { ··· 215 { i->time, 0 }, 216 { i->time, 0 } 217 }; 218 + @@ -1194,8 +1198,7 @@ int create_inode(char *pathname, struct inode *i) 219 goto failed; 220 } 221 ··· 223 - AT_SYMLINK_NOFOLLOW); 224 + res = lutimes(pathname, times); 225 if(res == -1) { 226 + EXIT_UNSQUASH_STRICT("create_inode: failed to" 227 + " set time on %s, because %s\n", 228 + @@ -2683,6 +2686,7 @@ void initialise_threads(int fragment_buffer_size, int data_buffer_size, int cat_ 229 + sigemptyset(&sigmask); 230 + sigaddset(&sigmask, SIGQUIT); 231 + sigaddset(&sigmask, SIGHUP); 232 + + sigaddset(&sigmask, SIGALRM); 233 + if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) != 0) 234 + EXIT_UNSQUASH("Failed to set signal mask in initialise_threads\n"); 235 + 236 diff --git a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h 237 index 934618b..0e680ab 100644 238 --- a/squashfs-tools/unsquashfs.h ··· 245 + #define FNM_EXTMATCH 0 246 +#endif 247 + 248 + #include "endian_compat.h" 249 + #include "squashfs_fs.h" 250 + #include "unsquashfs_error.h" 251 diff --git a/squashfs-tools/unsquashfs_info.c b/squashfs-tools/unsquashfs_info.c 252 index c8e2b9b..7d4f7af 100644 253 --- a/squashfs-tools/unsquashfs_info.c 254 +++ b/squashfs-tools/unsquashfs_info.c 255 + @@ -96,31 +96,22 @@ void dump_state() 256 void *info_thrd(void *arg) 257 { 258 sigset_t sigmask; ··· 289 "because %s\n", strerror(errno)); 290 } 291 } 292 + @@ -132,8 +123,12 @@ void *info_thrd(void *arg) 293 /* set one second interval period, if ^\ received 294 within then, dump queue and cache status */ 295 waiting = 1;