Opened 17 years ago

Last modified 6 years ago

#3768 new enhancement

Converter problem with Mac OS packages

Reported by: mael.hillereau@… Owned by: nobody@…
Priority: low Milestone:
Component: converters Version: 1.5.0svn
Severity: minor Keywords: patch, os=macosx, triage
Cc: lasgouttes, Juergen Spitzmueller, bewihelm@…, younes@…, sts@…, Stephan Witt

Description (last modified by ps)

LyX doesn't support graphics if they are stored as Mac OS X packages. Mac OS X packages are unix folders
disguised to look like single files. They are part of Mac OS X bundles (which may be packages, and also
some other folders and files).

When LyX converts graphics, some tests for checking that the input file exists are performed thanks to the
'IsFileReadable(string)' function (fileTools.c). The problem is that when this file is a Mac OS package, which
is for instance the case of '.graffle' figures (Omnigraffle software) only if they include images, it is actually
a unix folder, and thus isn't recognized as a file! This results in a "File not found" error message, and no
converter call. However, the file may really exist as a folder (a package).

Attachments (8)

graphics-as-macos-packages.patch (1.9 KB ) - added by mael.hillereau@… 17 years ago.
A first patch that supports folders when they have an extension (for LyX 1.4.4)
graphics-as-macos-packages2.patch (2.3 KB ) - added by mael.hillereau@… 17 years ago.
The same patch as 1837 but for LyX 1.5.0rc1
test.zip (8.5 KB ) - added by mael.hillereau@… 17 years ago.
Lyx test file using two omnigraffle figures
graphics-as-macos-packages3.patch (9.3 KB ) - added by mael.hillereau@… 17 years ago.
A new patch for LyX 1.5.0rc1, where updates are managed through the timestamp
graphics-as-macos-packages3.2.patch (6.6 KB ) - added by mael.hillereau@… 17 years ago.
Same patch as 1868, but in unified diff format
graphics-as-macos-packages4.patch (8.7 KB ) - added by mael.hillereau@… 17 years ago.
A new patch correcting a bug
graphics-as-macos-packages5.patch (7.7 KB ) - added by mael.hillereau@… 17 years ago.
New patch for 1.5.0rc2
graphics-as-macos-packages7.patch (7.5 KB ) - added by mael.hillereau@… 17 years ago.
Updated patch (for use with 1.5.0)

Download all attachments as: .zip

Change History (45)

comment:1 by mael.hillereau@…, 17 years ago

op_sys: otherMacOS X

comment:2 by mael.hillereau@…, 17 years ago

As said Jean-Marc Lagouttes in the devel list (http://www.mail-archive.com/lyx-devel@lists.lyx.org/
msg118804.html), it would be better to use real Mac OS X code to determine whether a
directory is a package. According to Apple's Bundle Software Guide, the 'CFBundleCreate(...)' function
could do the job.

As also mentionned by Jean-Marc, CRC could be computed by iterating on the files inside the directory.

comment:3 by Uwe Stöhr, 17 years ago

Keywords: patch added

comment:4 by mael.hillereau@…, 17 years ago

attachments.description: A first patch which supports folders when they have an extensionA first patch that supports folders when they have an extension (for LyX 1.4.4)

by mael.hillereau@…, 17 years ago

A first patch that supports folders when they have an extension (for LyX 1.4.4)

comment:5 by mael.hillereau@…, 17 years ago

attachments.isobsolete: 01

comment:6 by mael.hillereau@…, 17 years ago

Version: 1.4.41.5.0svn

by mael.hillereau@…, 17 years ago

The same patch as 1837 but for LyX 1.5.0rc1

comment:7 by mael.hillereau@…, 17 years ago

attachments.isobsolete: 01

by mael.hillereau@…, 17 years ago

Attachment: test.zip added

Lyx test file using two omnigraffle figures

by mael.hillereau@…, 17 years ago

A new patch for LyX 1.5.0rc1, where updates are managed through the timestamp

comment:8 by mael.hillereau@…, 17 years ago

attachments.isobsolete: 01

by mael.hillereau@…, 17 years ago

Same patch as 1868, but in unified diff format

comment:9 by mael.hillereau@…, 17 years ago

attachments.isobsolete: 01

comment:10 by Uwe Stöhr, 17 years ago

Milestone: 1.5.1

by mael.hillereau@…, 17 years ago

A new patch correcting a bug

comment:11 by mael.hillereau@…, 17 years ago

attachments.isobsolete: 01

comment:12 by Uwe Stöhr, 17 years ago

Cc: bennett.helm@… added

comment:13 by Uwe Stöhr, 17 years ago

Cc: lasgouttes@… added

Bennett JMarc, what about this patch?

comment:14 by lasgouttes, 17 years ago

I am sorry but my time right now to handle this is a bit scarce and I do not
think that this problem (while annoying) is a top urgency for 1.5.0... My
thoughts about the patch:

  • the function is_macos_file_readable should be renamed to something like is_readable_file_or_bundle and really check whether the file is a bundle. The check for non-null extension seems insufficient to me.

As an alternative, you could add a bool "allowbundle" in isFileReadable
so that it works correctly in cases where bundles are allowed. This would be
more elegant than using directly fs_extra stuff.

To find out whether a file is a bundle, it suffices to check the return value
of CFBundleGetPackageInfoInDirectory:

http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/Reference/reference.html#//apple_ref/c/func/CFBundleGetPackageInfoInDirectory

  • I am not sure I understand what the patch does wrt checksums for directories. Does it just ignore them? In this case, I would prefer (although it is a big hack) a solution where we add at the beginning of sum() something like

if (is_directory(file))

return 1;

Later we will need a real sum for directories (until you have a good
alternative).

  • concerning the OSX ifdefs: ideally there should be none. In practice, there should be none in files that do not already contain platform ifdefs.

comment:15 by mael.hillereau@…, 17 years ago

Cc: younes.a@… added

comment:16 by bewihelm@…, 17 years ago

I tried to test this but was unable to do so.

  1. There seems to be something wrong with the 2 omnigraffle figures: one shows

up on my computer as a folder; the other shows up as a Unix Executable File. (I
don't have omnigraffle, so I otherwise am unable to test.)

  1. The proposed patch fails to apply against RC2 (as well as current svn):

02:12:51 | bennett:~/Desktop/lyx-1.5.0rc2> patch -p1 < ~/Desktop/test-graphics.diff
patching file src/ConverterCache.cpp
Hunk #1 FAILED at 279.
Hunk #2 FAILED at 388.
2 out of 2 hunks FAILED -- saving rejects to file src/ConverterCache.cpp.rej
patching file src/graphics/GraphicsCacheItem.cpp
Hunk #2 FAILED at 376.
1 out of 2 hunks FAILED -- saving rejects to file
src/graphics/GraphicsCacheItem.cpp.rej
patching file src/graphics/GraphicsConverter.cpp
Hunk #1 FAILED at 325.
1 out of 1 hunk FAILED -- saving rejects to file
src/graphics/GraphicsConverter.cpp.rej
patching file src/insets/InsetGraphics.cpp
Hunk #2 FAILED at 475.
Hunk #3 FAILED at 589.
Hunk #4 FAILED at 773.
3 out of 4 hunks FAILED -- saving rejects to file src/insets/InsetGraphics.cpp.rej
patching file src/support/FileMonitor.cpp
Hunk #1 FAILED at 98.
Hunk #2 FAILED at 169.
2 out of 2 hunks FAILED -- saving rejects to file src/support/FileMonitor.cpp.rej
patching file src/support/fs_extras.cpp
patching file src/support/fs_extras.h

comment:17 by mael.hillereau@…, 17 years ago

  1. There seems to be something wrong with the 2 omnigraffle figures: one shows

up on my computer as a folder; the other shows up as a Unix Executable File. (I
don't have omnigraffle, so I otherwise am unable to test.)

You need OG to see the figures as packages. Otherwise "test2.graffle" will be
seen as a file and "test1.graffle" as a directory.

You can get a free copy of OG (but limited to 10 elements per figure AFAIR):
http://www.omnigroup.com/applications/omnigraffle/

  1. The proposed patch fails to apply against RC2 (as well as current svn):

02:12:51 | bennett:~/Desktop/lyx-1.5.0rc2> patch -p1 <

~/Desktop/test-graphics.diff

That's because of tabs: my text editor replaced them by spaces. Just add option
"-l" and that will be ignored.

comment:18 by Juergen Spitzmueller, 17 years ago

Cc: j.spitzmueller@… added

I'm not sure this is something for 1.5.1 (or rather 1.5.2). It needs to be
tested carefully, in any case.

by mael.hillereau@…, 17 years ago

Updated patch (for use with 1.5.0)

comment:19 by mael.hillereau@…, 17 years ago

attachments.isobsolete: 01

comment:20 by lasgouttes, 17 years ago

Milestone: 1.5.11.5.2

1.5.1 is an emergency relelase. Moving all to 1.5.2

comment:21 by Juergen Spitzmueller, 17 years ago

Milestone: 1.5.21.5.3

1.5.2 is frozen. This bug has to be postponed to 1.5.3.

comment:22 by Juergen Spitzmueller, 16 years ago

Milestone: 1.5.31.5.4

1.5.3 is released.

comment:23 by Juergen Spitzmueller, 16 years ago

Sorry, this bug didn't get the attention it deserved. Unfortunately, I do not
understand this stuff very well.
Jean-Marc, could you have a look at this issue, please?

comment:24 by lasgouttes, 16 years ago

Cc: sts@… added

I am not sure what is the best way to handle this stuff, and I am a bit busy
these days. Stefan, do you have any ideas about that?

comment:25 by Juergen Spitzmueller, 16 years ago

Milestone: 1.5.41.5.5

Soft freeze for 1.5.4: from now on, only critical bugs and regressions are
allowed.

comment:26 by Juergen Spitzmueller, 16 years ago

Milestone: 1.5.51.5.6

LyX 1.5.5svn is frozen.

comment:27 by Juergen Spitzmueller, 16 years ago

Milestone: 1.5.61.5.7

1.5.6 is released.

comment:28 by Juergen Spitzmueller, 15 years ago

Milestone: 1.5.71.6.x

WONTFIX for 1.5. The status of this bug in 1.6.0 needs to be checked.

comment:29 by ps, 15 years ago

Priority: highlow

comment:30 by ps, 15 years ago

Description: modified (diff)
Keywords: os=macosx added

comment:31 by Richard Heck, 13 years ago

Milestone: 1.6.x

comment:32 by Juergen Spitzmueller, 12 years ago

Cc: Juergen Spitzmueller added; j.spitzmueller@… removed

comment:33 by Richard Heck, 10 years ago

Component: convertorsconverters

in reply to:  24 comment:34 by Scott Kostyshak, 9 years ago

Cc: switt added

Replying to lasgouttes:

I am not sure what is the best way to handle this stuff, and I am a bit busy
these days. Stefan, do you have any ideas about that?

Any comments Stephan? Is this bug still relevant and worth looking at?

comment:35 by lasgouttes, 9 years ago

Cc: Stephan Witt added; switt removed

There is no switt user

comment:36 by lasgouttes, 9 years ago

Cc: lasgouttes added; lasgouttes@… removed

comment:37 by Richard Kimberly Heck, 6 years ago

Can anyone have a look at this old bug?

comment:38 by Richard Kimberly Heck, 3 years ago

Keywords: triage added
Note: See TracTickets for help on using tickets.