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

Generated zip file wrecks file/folder permissions! #594

Open
justlevine opened this issue Sep 7, 2019 · 4 comments
Open

Generated zip file wrecks file/folder permissions! #594

justlevine opened this issue Sep 7, 2019 · 4 comments
Assignees
Labels
gulp Gulp related issues

Comments

@justlevine
Copy link

Issue Overview

Not sure what, why, or how to even debug this, but I just tried extracting that generated zip file on my server (siteground), and all the non-top-level files and folders had their permissions wrecked!

If i manually zip the dist theme, then extraction works fine.

Describe your environment

Windows 10. WP-Rig 2.0.1, node 10.15.1, npm 6.4.1 to generate the bundled.zip, extracted to Siteground

Steps to Reproduce

  1. run npm run bundle
  2. upload the generated zip to the wp-content/themes folder on the server.
  3. extract the theme on the server.

Expected Behavior

The file/folder permissions would be preserved

Current Behavior

The permissions of all top-level files and folders are 666, and the permissions of all subfolders/files are nonexistent.

Screenshots / Video

Capture

@ataylorme
Copy link
Contributor

@justlevine I'm not quite sure how to debug this either. We are using gulp-zip for creating the .zip archive.

You can disable the .zip creating in the configuration and create it manually as a workaround.

There is a similar issue on that repo that suggests using gulp-chmod to change the permissions of the files prior to having them compressed.

However, I don't want to dictate file permissions to users of WP Rig. I am willing to help you modify your copy of WP Rig to do this. If it does indeed solve the problem, perhaps the file permissions can be a config setting.

@ataylorme ataylorme added the gulp Gulp related issues label Sep 8, 2019
@ataylorme ataylorme self-assigned this Sep 8, 2019
@justlevine
Copy link
Author

justlevine commented Sep 8, 2019

Thanks! For now I'm manually zipping and uploading :)

I'm going to take a look at that GitHub issue and see if it resolves my problems, and report back. I will say that I've used gulp-zip in other projects, and never ran into this before...

Agree that file permissions shouldn't be dictated, and would humbly suggest holding off on that unless both a) the problem isn't straightforward to resolve and b) it's more widespread than just myself.

(edit: I was using gulp-vinyl-zip, not gulp-zip).

@justlevine
Copy link
Author

It seems to be a known issue with the zip folders explicitly created by gulp on windows machines (verses inherently).

Adding gulp-chmod worked (only the folder permissions needed to be changed), but so did adding {nodir: true} to all the gulp.src calls ( suggested here ).

Not sure which approach is better.

ataylorme added a commit to ataylorme/wprig that referenced this issue Sep 16, 2019
See wprig#594. gulp `src` passes directories by default. However, on Windows and Linux the permissions are different so if the prod bundle is created on a Windows machine and deployed to a Linux server there are issues. Setting `nodir: true` in gulp `src` is a workaround suggested [here](sindresorhus/gulp-zip#64 (comment)).
@ataylorme
Copy link
Contributor

@justlevine thanks for doing the research here. Can you test #604? I think nodir: true only needs to be set on gulp src when reading the files to zip, not on all src calls.

@robruiz robruiz mentioned this issue Dec 30, 2020
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gulp Gulp related issues
Projects
None yet
Development

No branches or pull requests

2 participants