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

testing the read-only permission of Pkg.add #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matthijscox-asml
Copy link
Collaborator

To make sure we never again miss something like #45

@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Merging #47 (d4f9257) into main (1f1adda) will not change coverage.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #47   +/-   ##
=======================================
  Coverage   94.62%   94.62%           
=======================================
  Files          10       10           
  Lines         521      521           
=======================================
  Hits          493      493           
  Misses         28       28           
Files Changed Coverage Δ
src/write.jl 87.70% <100.00%> (ø)

@matthijscox-asml
Copy link
Collaborator Author

Hmm, I cannot set chmod(edited_template_path, 0o444; recursive=true) on ubuntu in the test?

IOError: stat("/tmp/jl_MFdsV3/no-slides/[Content_Types].xml"): permission denied (EACCES)

@jaakkor2
Copy link
Contributor

If chmod("/tmp/jl_MFdsV3/no-slides", 0o444, recursive=true) sets the directory first to be read-only, then stat("/tmp/jl_MFdsV3/no-slides/[Content_Types].xml") fails.

mkdir foo
touch > foo/bar
chmod u-x foo
stat foo/bar

gives me stat: cannot stat ‘foo/bar’: Permission denied. The directory needs to have execute bit in order to files be accessed.

One could set chmod(unzipped_dir, 0o770, recursive=true) to make sure files are writable and directories are executable in case the template was copied to the temp directory from files inside the PPTX-package (or some other directory without write bits.

Or maybe a bit better not to put execute bit on the files

for (root, dirs, files) in walkdir(unzipped_dir)
    for dir in dirs
        chmod(dir, 0x770)
    end
    for file in files
        chmod(file, 0o660)
    end
end

Addendum: On PPTX 0.6.5 that did not set the permissions on [Content_Types].xml

using PPTX
pres = Presentation()
write("foo.pptx", pres, template_path=joinpath(PPTX.TEMPLATE_DIR, "no-slides.pptx")) # works
write("foo.pptx", pres, template_path=joinpath(PPTX.TEMPLATE_DIR, "no-slides"))       # fails

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

Successfully merging this pull request may close these issues.

2 participants