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

Not preserving permissions. #7

Closed
ghost opened this issue Dec 21, 2013 · 15 comments
Closed

Not preserving permissions. #7

ghost opened this issue Dec 21, 2013 · 15 comments

Comments

@ghost
Copy link

ghost commented Dec 21, 2013

For some reason, when I run this, the compressed images don't preserve permissions. I have to chmod 644 them to get them to show on web server properly.

@plasticine
Copy link
Owner

So they blow away permissions that were set in source files? Will check it out. Thanks.

@ewlarson
Copy link

+1 for different permissions after optimization.

@echarp
Copy link

echarp commented Jan 25, 2014

It seems to affect some images, jpeg in particular but not png...

@reneruiz
Copy link

reneruiz commented Feb 1, 2014

I'm seeing this too. It's affecting pngs for me. But it's not consistently re-writing permissions.
image 2014-02-01 at 3 59 44 pm

@brandonparsons
Copy link

Ditto - png's.

@dikaio
Copy link

dikaio commented Mar 2, 2014

Same here. @roundedbygravity, I saw another issue from you here on github that made use of the after_build that changed permissions, I've been using that with good success but not here with middleman-imageoptim gem, are you experience the same?

class FixPermissions < Middleman::Extension
  def initialize(app, options_hash={}, &block)
    super
    app.after_build do |builder|
      builder.run 'chmod 755 build/assets/fonts/*'
      builder.run 'chmod 644 build/assets/images/*'
      builder.run 'chmod 755 build/assets/javascripts/*'
      builder.run 'chmod 755 build/assets/stylesheets/*'
    end
  end
end

::Middleman::Extensions.register(:fix_perm, FixPermissions)

@kaishin
Copy link

kaishin commented Mar 5, 2014

I'm having the same issue with .jpg files.

@pointdexter
Copy link

I also have this problem with .jpg files. It changes the permissions from 644 to 600

@sdillingham
Copy link

I'm seeing the same issue on both PNGs and JPGs, although strangely I'll get random PNGs where the permissions remain unaffected (644).

@dikaio
Copy link

dikaio commented Apr 9, 2014

Has anyone had any luck killing the permissions issue?

@richhollis
Copy link

The issue with the file permissions is with tjko/jpegoptim:

tjko/jpegoptim#5

This got fixed in v1.3.1 of jpegoptim.

My Ubuntu 12.04 had version v1.2.5

I then tried to follow the instructions in https://github.com/toy/image_optim to build jpegoptim:

cd /tmp
curl -O http://www.kokkonen.net/tjko/src/jpegoptim-1.3.1.tar.gz
tar zxf jpegoptim-1.3.1.tar.gz
cd jpegoptim-1.3.1
./configure && make && make install

which resulted in:

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking for jpeg_read_header in -ljpeg... no
Cannot find libjpeg or you have too old version (v6 or later required).

I then ran:

sudo apt-get install libjpeg8-dev

When I then ran the configure script it then configured OK but the make was unhappy:

./configure && make && make install
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking for jpeg_read_header in -ljpeg... yes
checking for round in -lm... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for unistd.h... (cached) yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking for string.h... (cached) yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking size of long... 8
checking size of int... 4
checking for getopt_long... yes
checking for mkstemps... yes
checking for broken jmorecfg.h (METHODDEF)... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
make: `jpegoptim' is up to date.
/usr/bin/install -c -d -m 755 //usr/local/share/man/man1
/usr/bin/install: cannot change permissions of ‘//usr/local/share/man/man1’: No such file or directory
make: *** [install.dirs] Error 1

I'm not really sure what it's trying to do with a non-existent file /usr/local/share/man/man1 but I've just worked around this by renaming the existing jpegoptim. Maybe somebody else can finesse this patch a bit better than me!

which jpegoptim
/usr/bin/jpegoptim

sudo mv /usr/bin/jpegoptim /usr/bin/jpegoptim.old
sudo mv jpegoptim /usr/bin/jpegoptim

jpegoptim --help
jpegoptim v1.3.1  Copyright (c) Timo Kokkonen, 1996-2014.
Usage: jpegoptim [options] <filenames> 
...

Now when I run my middleman build task my permissions don't get screwed up and I don't need any additional tasks to fix permissions etc.

@plasticine This is not an issue with your extension :)

@plasticine
Copy link
Owner

@richhollis ah, you are awesome.

Yeah I've suspected this for ages but had no idea how to actually narrow it down. Thanks so much for doing the legwork.

@dikaio
Copy link

dikaio commented May 6, 2014

I still have permission issues with jpegoptim v1.3.1 installed, can anyone else confirm?

@saragibby
Copy link

Getting .jpg file permissions changed from 644 to 600 in jpegoptim v 1.4.1

@dikaio
Copy link

dikaio commented Nov 13, 2014

@saragibby I think this project has been abandoned. The permissions issue has been a problem for almost a year now. I think someone also forked the original imageoptim because there's no activity but no ones moved it over to middleman.

If I'm wrong and you know of a solution or find one I'd be happy to hear about it!

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

No branches or pull requests