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

Unzip fail when zip contains chinese char on macOS 10.13 #7711

Closed
Whirlwind opened this issue May 6, 2018 · 21 comments
Closed

Unzip fail when zip contains chinese char on macOS 10.13 #7711

Whirlwind opened this issue May 6, 2018 · 21 comments

Comments

@Whirlwind
Copy link
Contributor

@Whirlwind Whirlwind commented May 6, 2018

I have a SDK, and there is a folder named FaceDistortion_20171205雪天的雪人 in the zip. When I exec pod install, I got a error:

[!] /usr/bin/unzip /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/file.zip -d /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah

Archive:  /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/file.zip
bcb02cc7602513e6c0adca622302aec2112217a7
   creating: /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/IESVideoEditor-bcb02cc760-bcb02cc7602513e6c0adca622302aec2112217a7/
  inflating: /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/IESVideoEditor-bcb02cc760-bcb02cc7602513e6c0adca622302aec2112217a7/.clang-format
  inflating: /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/XXXXXX-bcb02cc760-bcb02cc7602513e6c0adca622302aec2112217a7/README.md
checkdir error:  cannot create /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/Bundles/FaceDistortion_20171205����������
                 Illegal byte sequence
                 unable to process Bundles/FaceDistortion_20171205����������/.
checkdir error:  cannot create /var/folders/wc/3xbpwz1s7kbc3970y2kq8mvh0000gn/T/d20180506-48171-76pbah/Bundles/FaceDistortion_20171205����������
                 Illegal byte sequence
                 unable to process Bundles/FaceDistortion_20171205����������/content.json.

I download the zip from Safari and can unzip it by system gui tool.

The CocoaPods is v1.5.0 and macOS is v10.13.

@Whirlwind
Copy link
Contributor Author

@Whirlwind Whirlwind commented May 6, 2018

@segiddins
Copy link
Member

@segiddins segiddins commented May 6, 2018

Looks like potentially an encoding issue

@Whirlwind
Copy link
Contributor Author

@Whirlwind Whirlwind commented May 7, 2018

I try change the encoding:

export LC_CTYPE=C

But the CocoaPods require 'utf-8'. :(

@Whirlwind
Copy link
Contributor Author

@Whirlwind Whirlwind commented May 7, 2018

Maybe replace unzip with ditto:

ditto -V -x -k --sequesterRsrc --rsrc FILENAME.ZIP DESTINATIONDIRECTORY
@timothyqiu
Copy link

@timothyqiu timothyqiu commented May 14, 2018

It works OK on macOS 10.13.3 (my machine), but fails on 10.13.4 (my colleague's machine) 😞 It seems that the system upgrade changed the default encoding behavior of the unzip utility.

@Whirlwind
Copy link
Contributor Author

@Whirlwind Whirlwind commented May 18, 2018

How to fix it now?

@HadrainChen
Copy link

@HadrainChen HadrainChen commented May 29, 2018

Has anyone fix?

@Whirlwind
Copy link
Contributor Author

@Whirlwind Whirlwind commented May 29, 2018

I replace unzip with ditto.

@golderzhang
Copy link

@golderzhang golderzhang commented Jun 12, 2018

How to replace unzip ? Or other fix ?

@golderzhang
Copy link

@golderzhang golderzhang commented Jun 13, 2018

I resolve the problem by changing the 'source' because the chinese char is not important.

  1. Find the 'xxx' 's location.
    In terminal execute find .cocoapods/repos/master/Specs -iname xxx
  2. Change to the location and entry the version's directory.
  3. Open the 'xxx.podspec.json' file and look up the key named 'source'.
  4. Manually download the source and unzip the 'xxx.zip' by GUI unzip tools.
  5. Modify the chinese char to ascii char then zip all files to 'xxx.zip'.
  6. Move the new 'xxx.zip' to your server's path and keep the server open. (eg. Mac's apache server path)
  7. Modify the 'source' in 'xxx.podspec.json' file to your new server's path.
  8. Now you can execute pod install --no-repo-update or pod update --no-repo-update

It works for me. Good luck!

@Whirlwind
Copy link
Contributor Author

@Whirlwind Whirlwind commented Jun 20, 2018

I hook the unzip function to ditto, it works.

@stale
Copy link

@stale stale bot commented Sep 18, 2018

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

@Whirlwind
Copy link
Contributor Author

@Whirlwind Whirlwind commented Sep 18, 2018

require 'cocoapods-downloader/http'

module Pod
    module Downloader

        # macos 10.13.4 use APFS, it's unzip have a encoding bug to Chinese Path.
        # We use `ditto` instead of `unzip`
        # see https://github.com/CocoaPods/CocoaPods/issues/7711
        class RemoteFile < Base
            executable :ditto
            def unzip!(*args)
                flag = args.index("-d")
                unpack_from = args[flag - 1]
                unpack_to = args[flag + 1]
                ditto! '-x', '-k', '--sequesterRsrc', '-rsrc', unpack_from, unpack_to
            end
        end
    end
end

@stale stale bot removed the s1:awaiting input label Sep 18, 2018
@stale
Copy link

@stale stale bot commented Dec 17, 2018

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

@amorde
Copy link
Member

@amorde amorde commented Dec 19, 2018

This seems like something we can fix.

@stale stale bot removed the s1:awaiting input label Dec 19, 2018
@Whirlwind
Copy link
Contributor Author

@Whirlwind Whirlwind commented Dec 19, 2018

I am not sure that this issue still active in macOS 10.14. Because I keep the hook method in my project, and the all pods remove the Chinese path.

@stale
Copy link

@stale stale bot commented Mar 19, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

@stale
Copy link

@stale stale bot commented Mar 26, 2019

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

@stale stale bot closed this Mar 26, 2019
@bharathns
Copy link

@bharathns bharathns commented Jul 30, 2019

I replace unzip with ditto.

works for me thanks

@asrocha95
Copy link

@asrocha95 asrocha95 commented Jan 6, 2020

I have the macOS Catalina 10.15.2 and I still have this issue. The ditto workaround works great but there is still an issue with the unzip command.

@diofeher
Copy link

@diofeher diofeher commented Aug 12, 2020

ditto worked great for me :)

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

Successfully merging a pull request may close this issue.

None yet
10 participants