Exiv2::fileExists() fails on CIFS volume

Added by Matthias Welwarsky over 6 years ago

I can't have exiv2 retrieve information from images stored on a NAS that I mount via Linux CIFS file system. It always errors out with "file does not exist". I googled around a bit and found that:

As documented in various places on the Intertubes, you need to #define _FILE_OFFSET_BITS 64 if you want stat(2) to work properly on CIFS mounted volumes on Linux. The reason is that glibc now uses stat64() syscall, but if the inode number is too large to fit into struct stat on a 32bit system there is an EOVERFLOW error. The required fix is to compile the project with -D_FILE_OFFSET_BITS=64.

Now, how do I get exiv2 to compile with that? I hacked the toplevel CMakeList.txt but I'm certain that there must be a proper configure check to be used.

Help?

See also feature_test_macros(7)


Replies (8)

RE: Exiv2::fileExists() fails on CIFS volume - Added by Andreas Huggel over 6 years ago

Thanks for the info. This sounds like the define should be added to the default configuration. Or is there any reason why it shouldn't be defined always?

If you use the autoconf build scripts (which is still the default and supported way to build exiv2) you can export CPPFLAGS=-D_FILE_OFFSET_BITS=64 before running ./configure. I'm not sure if that works with cmake too.

Alternatively, add the define to config/config.h.in and/or config/config.h.cmake and/or msvc/include/exv_msvc.h if building with the autoconf scripts, cmake and/or MSVC on Windows respectively.

Andreas

RE: Exiv2::fileExists() fails on CIFS volume - Added by Sean Droms about 6 years ago

Hello, I am having the same issue as Matthias. I am trying to use jBrout or qPhotoTag to tag a large collection of photos on a cifs-mounted device (a DNS323 NAS in particular), but Exiv2 fails to modify the IPTC keywords. The error is:

Exiv2 exception in modify action for file /home/sean/pictures/test/IMG_2482.JPG:
/home/sean/pictures/test/IMG_2482.JPG: Failed to open file (w+b):  (errno = 2)

I tried to compile Exiv2 by adding the line "#define _FILE_OFFSET_BITS 64" to both config/config.h and config/config.h.in, then running configure, make, make install.

Even when I use the copy of exiv2 in the src directory after compiling, I get the same error.

sean@cittagazze:~/exiv2-0.21.1/src$ ./exiv2 -M"add Iptc.Application2.Keywords Evey-cifs" ~/pictures/test/IMG_2482.JPG 
Exiv2 exception in modify action for file /home/sean/pictures/test/IMG_2482.JPG:
/home/sean/pictures/test/IMG_2482.JPG: Failed to open file (w+b):  (errno = 2)

Is there somewhere else I need to add the #define to make this work? Any help would be appreciated!

I am using Ubuntu 10.04.

RE: Exiv2::fileExists() fails on CIFS volume - Added by Andreas Huggel about 6 years ago

Hmm, either that fix doesn't work in your environment or exiv2 wasn't rebuilt completely. To ensure that it is, can you try again, following exactly these steps:

1. Start from scratch, with a newly unzipped and untarred distribution
2. export CPPFLAGS=-D_FILE_OFFSET_BITS=64
3. Run configure, make, make install as usual

Does that help?

Andreas

RE: Exiv2::fileExists() fails on CIFS volume - Added by Sean Droms about 6 years ago

It does not change the outcome, unfortunately.

I ran, as you asked, on a completely fresh copy of exiv2-0.21.1,

export CPPFLAGS=-D_FILE_OFFSET_BITS=64
configure
make
make install

For what it's worth, during compilation, I do see the -D_FILE_OFFSET_BITS=64 present in each command.

Then, as before,

sean@cittagazze:~/exiv2-0.21.1/src$ ./exiv2 -M"add Iptc.Application2.Keywords Evey-cifs" ~/pictures/test/IMG_2482.JPG
Exiv2 exception in modify action for file /home/sean/pictures/test/IMG_2482.JPG:
/home/sean/pictures/test/IMG_2482.JPG: Failed to open file (w+b):  (errno = 2)

It might be pointed out that I now have 3 copies of exiv2 on my system. One from the Ubuntu repository (v0.19 in /usr/bin/), one from this make install (v0.21 in /usr/local/bin/) and one in the src/ directory (v0.21). Of course, above I was running the one in src/, but trying with the one in /usr/local/bin gives the same result.

This probably doesn't matter, but when I run make install, the last block of output is:

installing pl.gmo as /usr/local/share/locale/pl/LC_MESSAGES/exiv2.mo
installing ru.gmo as /usr/local/share/locale/ru/LC_MESSAGES/exiv2.mo
installing sk.gmo as /usr/local/share/locale/sk/LC_MESSAGES/exiv2.mo
if test "exiv2" = "gettext-tools"; then \
      /bin/sh .././config/mkinstalldirs /usr/local/share/gettext/po; \
      for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot   Makevars.template; do \
        /usr/bin/install -c -m 644 ./$file \
                /usr/local/share/gettext/po/$file; \
      done; \
      for file in Makevars; do \
        rm -f /usr/local/share/gettext/po/$file; \
      done; \
    else \
      : ; \
    fi
make[1]: Leaving directory `/home/sean/exiv2-0.21.1/po'
sean@cittagazze:~/exiv2-0.21.1$ 

I don't know much about this process, but it didn't seem right to me.

I appreciate any other tips you could give me. I'm fairly new to compiling from source, so if there's something obvious I'm missing here, I apologize!

RE: Exiv2::fileExists() fails on CIFS volume - Added by Andreas Huggel about 6 years ago

For what it's worth, during compilation, I do see the -D_FILE_OFFSET_BITS=64 present in each command.

So it was compiled correctly. The output of make install also looks ok.

But I noticed that the error message that you get is not the same as that in the original report.
Can you show us the output of

ls -la /home/sean/pictures/test/IMG_2482.JPG

in particular, can you write to that file (permissions)?

Andreas

RE: Exiv2::fileExists() fails on CIFS volume - Added by Sean Droms about 6 years ago

Here is the output:

sean@cittagazze:~$ ls -la /home/sean/pictures/test/IMG_2482.JPG 
-rwxrwxrwx 1 sean sean 2202031 2011-07-10 08:39 /home/sean/pictures/test/IMG_2482.JPG

I'm generally able to modify files on the NAS. If you think it makes a difference, here is the fstab line I use to mount it at boot:

//nas/Volume_1    /media/nas    cifs    credentials=/home/sean/.smbcredentials,iocharset=utf8,file_mode=0770,dir_mode=0770,uid=sean,gid=sean    0    0

RE: Exiv2::fileExists() fails on CIFS volume - Added by Andreas Huggel about 6 years ago

Do you use a symbolic link somewhere in the path /home/sean/pictures/test/ since the NAS is mounted on /media/nas?
If so, can you try the exiv2 command with the actual path that has no symlink?

Also it seems the mode parameters in your fstab line (0770) contradict the ls -la output (777)?

But quite frankly, I have no idea what the problem is.

RE: Exiv2::fileExists() fails on CIFS volume - Added by Sean Droms about 6 years ago

I get the same error even when using the path where my nas is mounted in /media. I am not sure what is causing the discrepancy between mode parameters.

Thank you for trying to help. I think I am going to give up on this issue, unfortunately.

(1-8/8)

Redmine Appliance - Powered by TurnKey Linux