php-heic-to-jpg icon indicating copy to clipboard operation
php-heic-to-jpg copied to clipboard

Permission denied (absent execute-permission)

Open lon9man opened this issue 2 years ago • 6 comments

Hello, noticed interesting case.

WHAT I DID

i installed your package in 2 places:

  1. local development (docker) - Debian GNU/Linux 11 (bullseye) 5.4.0-137-generic
  2. dev-server Ubuntu 22.04.3 LTS 5.15.0-1031-aws

WHAT I GOT

i got different execute-permissions in these 2 cases.

  1. local development (docker) image

  2. dev-server image

in case 1 package works as expected. in case 2 package works with error:

Couldn't convert HEIC to JPG: 'sh: 1: /home/user/app/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64: Permission denied' | 
Bin used: 'php-heic-to-jpg-linux-arm64' HEIC: '/tmp/image-editor/image-editor-2iIvs9' 
Full Command: '/home/user/app/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64 "/tmp/image-editor/image-editor-2iIvs9" "/tmp/image-editor/image-editor-2iIvs9-19333623666504703814bc31.41181168" 2>&1' 
Output from heif-converter-image exe: 

when i add execute-permission for php-heic-to-jpg-linux-arm64 then package works as expected.

QUESTIONS

  1. why permissions are different on 2 environments?
  2. how should look correct execute-permissons for files?
  3. why in case 1 execute-permissions are absent for files php-heic-to-jpg-{os-architecture}, but package works as expected? and in case 2 - not?
  4. what is the suggestion to make it work in both cases (add execute-permissons for all needed files or something else)?

thanks!

lon9man avatar Sep 18 '23 10:09 lon9man

Hi, @lon9man! Thanks for reaching out! I am not sure why are they different but in the first case (local development (docker)) it used heicToJpg and execute permission was correct, so it worked 👍 In the second case, it tried to use php-heic-to-jpg-linux-arm64 probably because the "dev-server" is arm64 architecture. But execution permission wasn't set, so it threw an error.

Both cases acted logically, we just need to find out, why execution permission isn't set correctly for needed bin files (Second case) and yes, to make it work all needed files should have execute-permissions 👍

MaestroError avatar Sep 20 '23 17:09 MaestroError

@MaestroError, thanks for the response! Will you have a chance to detect the issue and update the package?

Offtop question: Method convertFromUrl creates temporary file inside project-root.. as for me it should create it inside /tmp to prevent make a mess.

Thanks!

lon9man avatar Sep 20 '23 17:09 lon9man

Strange, I think it should delete the temporary file right after execution. Sure, I will keep this issue open to remind me about it and I will update the package with the following fixes:

  • Setting correct execution permission for any platform
  • Delete the temp file created by convertFromUrl

MaestroError avatar Sep 20 '23 17:09 MaestroError

It deletes it if everything gone successfully, but if we got error - then file remains in Project-root and developer should delete artifacts manually.. if it will be located in /tmp in any case it will be good solution

lon9man avatar Sep 20 '23 21:09 lon9man

Any update on this? I'm also experiencing this installing in a docker container (Ubuntu 20.04)

Screenshot 2024-03-20 at 5 03 17 PM

jdevinemt avatar Mar 20 '24 23:03 jdevinemt

Hey @jdevinemt! Unfortunately not, I wasn't able to update it yet, but you can solve them easily by setting execution permission 👍

MaestroError avatar Mar 21 '24 06:03 MaestroError