What file permissions are needed in an XPI? - firefox

I recently received the following comment from the reviewer of one of my add-ons at the official Mozilla Add-ons website:
The permissions in your XPI are broken. Most files and directories do not have the expected read and execute permissions, or indeed any permissions at all.
I wasn't aware that file permissions were an issue in XPI files. To my knowledge, none of the files in my XPI need the execute bit set (I only package standard stuff: XUL, JavaScript, CSS, etc). I create my XPI in Windows using the Cygwin zip tool, and since Windows knows nothing about file permissions, they aren't stored as they would be in Linux.
What file permissions are expected for file and directory entries in an XPI? The Extension Packaging page at MDN has the following quote, but no associated details on what they should be:
... you must verify that the file system permissions for the directories and files for the extension are set properly. Otherwise, the Extension Manager may not function properly with the extension or the extension itself may not work properly.

This is typically an issue if you create the extension package on Windows but the extension is used on Linux or OS X later - Windows doesn't have any file permissions to be put into a ZIP archive and unpacking on Linux or OS X sometimes creates bogus file permissions (000 rather than the usual 755 or 644). You could try using a different ZIP packer, e.g. Info-ZIP that doesn't cause such issues for me. Better yet, don't require your extension to be unpacked at all - <em:unpack> is often used but rarely really required.

Related

MacOS: where to install global application data with r/w access

To where a pkg installer package on MacOS should install global application data ? All users of this specific system as well as the app itself should have read and write access to this data. Atm I install it to /Library/Application Support/"mycompany"/"MyApp" and modify the permissions. Is this a good practise for all MacOS versions ?
Thank you !
EDIT:
Meanwhile I have tested to r/w access files in this directory on Sierra and Mojave. It works like a charm when I set the permissions in my custom library folder recursively with chmod -R 777 (well, less would be enough).
BTW I do this with a batch post installation shell script in the packages app here. It's a great UI based app (instead of using a bunch of command line tools). Building the pkg can be automated by a single command line: /usr/local/bin/packagesbuild /path/to/the/project.pkgproj, so integration into a flawless workflow is easy.
Yes. The only change I'm aware of related to this was in 10.7 when Apple changed the /Library folder to a hidden directory. (unlisted in finder unless specified) The path remains unchanged.
https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html

If a folder is read-only, where do the pyc files go?

I am running .py files from a read-only network folder (via Python 2.7 on Windows). Are pyc files still generated? And if so, where do they go?
The contents are generated by the compiler, but they are simply not saved (a loader may set an alternate __cached__, but normally doesn't). The .pyc files are merely used to cache the result of the compilation. distutils.util.byte_compile has some documentation links for further details.

Create installable Firefox XPI for bootstrapped extension

I downloaded from addons repository a Firefox extension (url shortener), unzipped it and reworked a little bit to use another shortener service - i changed already only a url of shortening service and some names in meta - nothing of vital importance. If i try just to zip all directories and files as they are and try to install - installation fails with an alert
"This addon can't be installed - it could be corrupted"
I guess there are any troubles with zipping of it. I'm even sure, that there is a zipping problem, cause i tried to unzip the original extension, than to zip it without code changes and to install - same error alert.
Also the question is, how to create an installable XPI for the bootstrapped extension (it is:
without .jar-file,
with another directory structure,
installation
withour restart).
The structure of bootstrapped extension (which i have here) is:
/defaults
/locale
/resources
harness-options.json
locales.json
bootstrap.js
install.rdf
options.xul
I use 7-zip, but it is no problem to use any another archiving software.
Thank you for any advice!
Evgeniy
Got it done! Like it describes this answer https://stackoverflow.com/a/18992738/1992004 i zipped a whole folder, what led in error cause of a folder creation inside of archive. After i zipped only included subfolders, i got an installable xpi.

Permission denied error creating firebird embedded database in OSX

Firstly I am not 100% sure I am using the embedded firebird client under OSX. The install file that I downloaded from firebirdsql.org states that it contains Classic, Superclassic & Embedded. Unlike the windows version there does not appear to be a dedicated embedded library file in the package.
I have assumed that the libfbclient.dylib (renamed libgds.dylib for my use) can be used as embedded. If I am wrong then I guess thats the problem. Can someone tell me where I get the embedded dylib file?
If libfbclient.dylib is for embedded use also then my question remains. When I try to create the database file for the first time it fails with "Permission denied". I am trying to create this file in the users documents folder.
I am using the Interbase Express components in Delphi to connect. This has served me well for years under the windows environment.
The full error message is...
Exception class EIBInterBaseError with message 'I/O error during "open O_CREAT" operation for file '/Users/martin/Documents/LightFactoryShows/default.fdb" Error while trying to create file Permission denied'
Solved! After re-reading this document several times I finally got it:
http://www.ibphoenix.com/resources/documents/how_to/doc_103
The embedded library under OSX is the same as what would be called the exe in windows.
In the /Library/Framworks/Firebird.framework folder is an executable just called "Firebird". The key text I did not understand is this "renamed the Firebird file to libfbembed.dylib". My windows experience was tripping me up because in windows you would never rename an .exe to a .dll. I dont know if its possible in windows but I've never herd of it.
There was a couple more trivial things I needed to do so here is the full instructions.
1) Link the "Firebird" {executable} to /usr/local/lib/libgds.dylib
ln -s /Library/Frameworks/Firebird.framework/Firebird /usr/local/lib/libgds.dylib
2) Link the firebird.msg file so that it appears in the /usr/local/lib folder
ln -s /Library/Frameworks/Firebird.framework/Versions/A/Resources/English.lproj/var/firebird.msg /usr/local/lib/firebird.msg
3) Copy the "security2.fdb" to the /usr/local/lib folder and change its permissions to give write access. It does not work to make a link to this file.
cp /Library/Frameworks/Firebird.framework/Versions/A/Resources/English.lproj/var/security2.fdb /usr/local/lib
chmod 777 /usr/local/lib/security2.fdb.

Package executables along with Firefox addon

My addon requires to run certain exes and hence I used to package the exes alongwith my addon and put them under the content dir. At the time of running the exe, I used to access the executable by going to <ProfileDir>/extensions/<addon-unique-id>/content/ dir.
While I was trying to make my addon compatible with FF 4, i figured out that now the extensions do not get expanded into a directory under extension/ dir; rather a <addon-unique-id>.xpi file is present there.
Can someone tell me how can I access my exes now?
Thanks
Kapil
You can have it unpack still by adding a line to your install.rdf file.

Resources