- 
                Notifications
    
You must be signed in to change notification settings  - Fork 9
 
Modify quarantine attribute removal method #16
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
base: master
Are you sure you want to change the base?
Conversation
Replace xattr command with find to remove quarantine attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modifies the quarantine attribute removal method by replacing the xattr -drs command with a find command that executes xattr -d on each file individually.
- Replaces 
xattr -drswithfind ... -exec xattr -dfor quarantine attribute removal - Changes error handling from strict exit on failure to silently continuing with 
|| true - Removes the original error status code reporting
 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
        
          
                createinstalliso
              
                Outdated
          
        
      | echo "Copying installer application..." | ||
| ditto "${original_installer_application_path}" "${modified_installer_application_path}" >/dev/null || exit_with_status 220 "Failed to copy installer application." | ||
| xattr -drs "com.apple.quarantine" "${modified_installer_application_path}" >/dev/null || exit_with_status 219 "Failed to remove extended attribute com.apple.quarantine." | ||
| find "${modified_installer_application_path}" -exec xattr -d com.apple.quarantine {} \; 2>/dev/null || true # "${modified_installer_application_path}" >/dev/null || exit_with_status 219 "Failed to remove extended attribute com.apple.quarantine." | 
    
      
    
      Copilot
AI
    
    
    
      Aug 25, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling has been changed from providing a meaningful error message (exit code 219 with 'Failed to remove extended attribute com.apple.quarantine') to silently ignoring all failures with || true. This removes important error reporting that could help diagnose issues.
| find "${modified_installer_application_path}" -exec xattr -d com.apple.quarantine {} \; 2>/dev/null || true # "${modified_installer_application_path}" >/dev/null || exit_with_status 219 "Failed to remove extended attribute com.apple.quarantine." | |
| find "${modified_installer_application_path}" -exec xattr -d com.apple.quarantine {} \; 2>/dev/null || exit_with_status 219 "Failed to remove extended attribute com.apple.quarantine." | 
        
          
                createinstalliso
              
                Outdated
          
        
      | echo "Copying installer application..." | ||
| ditto "${original_installer_application_path}" "${modified_installer_application_path}" >/dev/null || exit_with_status 220 "Failed to copy installer application." | ||
| xattr -drs "com.apple.quarantine" "${modified_installer_application_path}" >/dev/null || exit_with_status 219 "Failed to remove extended attribute com.apple.quarantine." | ||
| find "${modified_installer_application_path}" -exec xattr -d com.apple.quarantine {} \; 2>/dev/null || true # "${modified_installer_application_path}" >/dev/null || exit_with_status 219 "Failed to remove extended attribute com.apple.quarantine." | 
    
      
    
      Copilot
AI
    
    
    
      Aug 25, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The find command with -exec will spawn a separate xattr process for each file found, which is less efficient than the original xattr -drs command that could process multiple files in a single invocation. Consider using find ... -print0 | xargs -0 xattr -d for better performance with many files.
| find "${modified_installer_application_path}" -exec xattr -d com.apple.quarantine {} \; 2>/dev/null || true # "${modified_installer_application_path}" >/dev/null || exit_with_status 219 "Failed to remove extended attribute com.apple.quarantine." | |
| find "${modified_installer_application_path}" -print0 | xargs -0 xattr -d com.apple.quarantine 2>/dev/null || true # "${modified_installer_application_path}" >/dev/null || exit_with_status 219 "Failed to remove extended attribute com.apple.quarantine." | 
Co-authored-by: Copilot <[email protected]>
The find command with -exec will spawn a separate xattr process for each file found, which is less efficient than the original xattr -drs command that could process multiple files in a single invocation. using `find ... -print0 | xargs -0 xattr -d` for better performance with many files.
| 
           Hi @startergo, thanks for your PR. Could you briefly explain why you suggested this change? As far as I can see, you a) want the command to remove the quarantine flag to never fail This makes sense if the command fails for certain files but not for others. It also means that, for the files where it fails, the quarantine flag does not break anything. Can you provide an example of when this situation occurred? I'd be interested to know which files fail to have the quarantine flag removed, and where you downloaded the installer application from. The reason for asking is, that I want to investigate why this happens and why your PR is required. Thanks!  | 
    
| 
           It was failing to build on the silicon Mac. It would just exit at that line. Now it works as designed. I guess somehow python overrode  and : But the python's  So in this respect a fix could be providing a simple absolute path for   | 
    
Add absolute path for the `xattr` command to use the Apple provided `xattr` command as the python version of `xattr` does not recognize `-r` (recursive) option.
| 
           @startergo Thanks for the update and the explanation behind the issue. So this falls into the same category as the issue here: #15 Therefore, I'd rather make an update that includes all external commands called from the script rather than fixing this command by command. I put that on my list for the next update. Thanks for your contribution and explanation. Michael  | 
    
Replace xattr command with find to remove quarantine attribute.