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

File symlink collision during MacOS IPSW extraction. #538

Open
2 tasks done
social-anthrax opened this issue Aug 22, 2024 · 0 comments
Open
2 tasks done

File symlink collision during MacOS IPSW extraction. #538

social-anthrax opened this issue Aug 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working triage

Comments

@social-anthrax
Copy link

What happened?

Running ipsw extract -f on the Universal 14.6.1 IPSW file fails whilst extracting 090-91768-091.dmg with

failed to extract files from SystemOS 090-91768-091.dmg: failed to extract File System files from IPSW: failed to extract 23G93__MacOS/System/Library/Frameworks/AuthenticationServices.framework/Resources: symlink Versions/Current/Resources 23G93__MacOS/System/Library/Frameworks/AuthenticationServices.framework/Resources: file exists

How can we reproduce this?

Ran on MacOS Sonoma 14.6.1

sudo ipsw extract -f ./UniversalMac_14.6.1_23G93_Restore.ipsw --pattern '.*'

where ./UniversalMac_14.6.1_23G93_Restore.ipsw is sourced from https://updates.cdn-apple.com/2024SummerFCS/fullrestores/062-52859/932E0A8F-6644-4759-82DA-F8FA8DEA806A/UniversalMac_14.6.1_23G93_Restore.ipsw

ipsw version

Version: 3.1.537, BuildCommit: 87806ca0bb5c255911f7b54def37536161e6e54c

Search

  • I did search for other open and closed issues before opening this

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

The preferred behaviour would be to allow overwriting the file or skipping the file. The check would probably need to be added in utils/macos.go:

if err := filepath.Walk(mountPoint, func(path string, info os.FileInfo, err error) error {
if err != nil {
log.WithError(err).Debugf("failed to walk %s", mountPoint)
return nil // keep going
}
if info.IsDir() {
return nil
}
if pattern.MatchString(strings.TrimPrefix(path, mountPoint)) {
fname := strings.TrimPrefix(path, mountPoint)
fname = filepath.Join(destPath, fname)
if err := os.MkdirAll(filepath.Dir(fname), 0750); err != nil {
return fmt.Errorf("failed to create directory %s: %v", filepath.Join(destPath, filepath.Dir(fname)), err)
}
Indent(log.Info, 3)(fmt.Sprintf("Extracting to %s", fname))
if err := Copy(path, fname); err != nil {
return fmt.Errorf("failed to extract %s: %v", fname, err)
}
artifacts = append(artifacts, fname)
}
return nil
}); err != nil {
return nil, fmt.Errorf("failed to extract File System files from IPSW: %v", err)
}

@social-anthrax social-anthrax added bug Something isn't working triage labels Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants