running ditto from firefox on snow leopard

5 views
Skip to first unread message

Joel Reymont

unread,
Jan 26, 2010, 5:31:47 PM1/26/10
to darwin-dev@lists.apple.com Dev
I would for Firefox to detect if it's running on Snow Leopard and run ditto to compress itself.

What is the best way to run ditto? Should I use some ad-hoc launchd facility? Something else?

Thanks, Joel

---
http://wagerlabs.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (Darwi...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/darwin-dev-garchive-73044%40googlegroups.com

This email sent to darwin-dev-g...@googlegroups.com

Shantonu Sen

unread,
Jan 26, 2010, 5:38:23 PM1/26/10
to Joel Reymont, darwin-dev@lists.apple.com Dev
You're doomed.

Shantonu Sen
ss...@apple.com

Sent from my Mac Pro

On Jan 26, 2010, at 2:31 PM, Joel Reymont wrote:

> I would for Firefox to detect if it's running on Snow Leopard and run ditto to compress itself.
>
> What is the best way to run ditto? Should I use some ad-hoc launchd facility? Something else?
>
> Thanks, Joel
>
> ---
> http://wagerlabs.com
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-dev mailing list (Darwi...@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:

> http://lists.apple.com/mailman/options/darwin-dev/ssen%40apple.com
>
> This email sent to ss...@apple.com

Shantonu Sen

unread,
Jan 26, 2010, 5:40:09 PM1/26/10
to Shantonu Sen, darwin-dev@lists.apple.com Dev
Let me clarify. Modifying yourself is probably pretty dangerous, and may cause problems if you need to share the app with an older system.

Shantonu Sen
ss...@apple.com

Sent from my Mac Pro

Damien Sorresso

unread,
Jan 26, 2010, 6:24:43 PM1/26/10
to Joel Reymont, darwin-dev@lists.apple.com Dev
On Jan 26, 2010, at 2:31 PM, Joel Reymont wrote:
> I would for Firefox to detect if it's running on Snow Leopard and run ditto to compress itself.

Why?
--
Damien Sorresso
BSD Engineering
Apple Inc.

Joel Reymont

unread,
Jan 27, 2010, 2:14:10 AM1/27/10
to Damien Sorresso, darwin-dev@lists.apple.com Dev

On Jan 26, 2010, at 11:24 PM, Damien Sorresso wrote:

> On Jan 26, 2010, at 2:31 PM, Joel Reymont wrote:
>> I would for Firefox to detect if it's running on Snow Leopard and run ditto to compress itself.
>
> Why?

A compressed Firefox starts much faster on Snow Leopard.

---
http://wagerlabs.com

Joel Reymont

unread,
Jan 27, 2010, 2:21:51 AM1/27/10
to Shantonu Sen, darwin-dev@lists.apple.com Dev

On Jan 26, 2010, at 10:40 PM, Shantonu Sen wrote:

> Let me clarify. Modifying yourself is probably pretty dangerous,

So I'll have to 'schedule' the move, exit and do it, or something like that.

> and may cause problems if you need to share the app with an older system.

The assumption is that you are running on Snow Leopard. I don't know anyone who shares Firefox with an older system, usually people just download it.

This is the official bug that I'm working on:

https://bugzilla.mozilla.org/show_bug.cgi?id=516362

and related:

https://bugzilla.mozilla.org/show_bug.cgi?id=514083

Thanks, Joel

---
http://wagerlabs.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (Darwi...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

Damien Sorresso

unread,
Jan 27, 2010, 2:44:15 AM1/27/10
to Joel Reymont, darwin-dev@lists.apple.com Dev
On Jan 26, 2010, at 11:14 PM, Joel Reymont wrote:
> On Jan 26, 2010, at 11:24 PM, Damien Sorresso wrote:
>> On Jan 26, 2010, at 2:31 PM, Joel Reymont wrote:
>>> I would for Firefox to detect if it's running on Snow Leopard and run ditto to compress itself.
>>
>> Why?
>
> A compressed Firefox starts much faster on Snow Leopard.


By doing this, you're basically guaranteeing that Firefox can never participate in the code signing model. Maybe you don't care right now, but then again, maybe one day you'll want to use the Keychain APIs.


--
Damien Sorresso
BSD Engineering
Apple Inc.

_______________________________________________

Joel Reymont

unread,
Jan 27, 2010, 2:47:53 AM1/27/10
to Damien Sorresso, darwin-dev@lists.apple.com Dev

On Jan 27, 2010, at 7:44 AM, Damien Sorresso wrote:

> By doing this, you're basically guaranteeing that Firefox can never participate in the code signing model. Maybe you don't care right now, but then again, maybe one day you'll want to use the Keychain APIs.

I don't think it's a concern for now. That said, what is the best option of compressing Firefox on Snow Leopard? Ditto launched from a separate app using Launchd APIs?

Thanks, Joel

---
http://wagerlabs.com

_______________________________________________

Jean-Daniel Dupas

unread,
Jan 27, 2010, 2:56:10 AM1/27/10
to Joel Reymont, darwin-dev@lists.apple.com Dev

Le 27 janv. 2010 à 08:21, Joel Reymont a écrit :

>
> On Jan 26, 2010, at 10:40 PM, Shantonu Sen wrote:
>
>> Let me clarify. Modifying yourself is probably pretty dangerous,
>
> So I'll have to 'schedule' the move, exit and do it, or something like that.
>
>> and may cause problems if you need to share the app with an older system.
>
> The assumption is that you are running on Snow Leopard. I don't know anyone who shares Firefox with an older system, usually people just download it.
>

And now, if someone ask you, you can tell him you know at least one person. I have all my downloaded applications in a separate partition shared by both Leopard and Snow Leopard.

As a side note, the user that first launch Firefox may not be the one that install it and so, do not have the right to change it.
And as Damien noted, updating an application content breaks signature.

-- Jean-Daniel

Joel Reymont

unread,
Jan 27, 2010, 3:00:28 AM1/27/10
to Jean-Daniel Dupas, darwin-dev@lists.apple.com Dev

On Jan 27, 2010, at 7:56 AM, Jean-Daniel Dupas wrote:

> And now, if someone ask you, you can tell him you know at least one person. I have all my downloaded applications in a separate partition shared by both Leopard and Snow Leopard.

Thanks for pointing it out. I'll make sure compression is optional then.

> As a side note, the user that first launch Firefox may not be the one that install it and so, do not have the right to change it.

I'll add a pointer to this thread to the bug. I think we still want compression wherever we can.

Thanks, Joel

---
http://wagerlabs.com

_______________________________________________

Joel Reymont

unread,
Jan 27, 2010, 3:21:59 AM1/27/10
to Damien Sorresso, darwin-dev@lists.apple.com Dev
Damien,

On Jan 27, 2010, at 7:44 AM, Damien Sorresso wrote:

> By doing this, you're basically guaranteeing that Firefox can never participate in the code signing model.

Firefox download partial updates right now, including binary code. It kicks off the updater once the download is done and updates itself. This prevents Firefox from participating in the code signing model so compression would not be much different.

What are the huge benefits to participating in code signing?

> Maybe you don't care right now, but then again, maybe one day you'll want to use the Keychain APIs.

Is code signing a must to use the Keychain APIs? Can you please clarify?

Thanks, Joel

---
http://wagerlabs.com

_______________________________________________

Jean-Daniel Dupas

unread,
Jan 27, 2010, 3:29:51 AM1/27/10
to Joel Reymont, darwin-dev@lists.apple.com Dev

Le 27 janv. 2010 à 09:21, Joel Reymont a écrit :

> Damien,
>
> On Jan 27, 2010, at 7:44 AM, Damien Sorresso wrote:
>
>> By doing this, you're basically guaranteeing that Firefox can never participate in the code signing model.
>
> Firefox download partial updates right now, including binary code. It kicks off the updater once the download is done and updates itself. This prevents Firefox from participating in the code signing model so compression would not be much different.
>

wrong, partial update do not prevents codesign. Especially as the partial update can contains the updated code signature.

http://developer.apple.com/mac/library/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-DontLinkElementID_11

> What are the huge benefits to participating in code signing?
>
>> Maybe you don't care right now, but then again, maybe one day you'll want to use the Keychain APIs.
>
> Is code signing a must to use the Keychain APIs? Can you please clarify?
>

Please, read the documentation:

http://developer.apple.com/mac/library/documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html#//apple_ref/doc/uid/TP40005929-CH3-DontLinkElementID_1


-- Jean-Daniel

Joel Reymont

unread,
Jan 27, 2010, 3:34:14 AM1/27/10
to Jean-Daniel Dupas, darwin-dev@lists.apple.com Dev

On Jan 27, 2010, at 8:29 AM, Jean-Daniel Dupas wrote:

> wrong, partial update do not prevents codesign. Especially as the partial update can contains the updated code signature.

Can partial updates preserve compression on Snow Leopard?

How does Apple do this?

In other words, can we deliver a compressed Firefox for Snow Leopard -and- deliver compressed updates as well? I gather that the objection is to compress Firefox post-installation.

---
http://wagerlabs.com

Jean-Daniel Dupas

unread,
Jan 27, 2010, 4:03:23 AM1/27/10
to Joel Reymont, darwin-dev@lists.apple.com Dev

Le 27 janv. 2010 à 09:34, Joel Reymont a écrit :

>
> On Jan 27, 2010, at 8:29 AM, Jean-Daniel Dupas wrote:
>
>> wrong, partial update do not prevents codesign. Especially as the partial update can contains the updated code signature.
>
> Can partial updates preserve compression on Snow Leopard?
>
> How does Apple do this?
>
> In other words, can we deliver a compressed Firefox for Snow Leopard -and- deliver compressed updates as well? I gather that the objection is to compress Firefox post-installation.
>

Apple uses pkg to distribute their software and their updates. They don't have to support system older than the target one (as they distribute one package by major version if when needed), and the pkg format supports HFS compression (a class-dump of the private PackageKit reveal a useHFSPlusCompression property in PKPackageInfo), but as I avoid pkg as much as I can, I don't know if this is a public features and how to use it.


-- Jean-Daniel

Shantonu Sen

unread,
Jan 27, 2010, 11:30:08 AM1/27/10
to Joel Reymont, darwin-dev@lists.apple.com Dev
It sounds like you have all the tools to resolve this, I'm not sure what input you are requesting from the low-level Darwin OS community.

If Firefox already has a mechanism for self-patching using binary deltas, it must have already solved the authentication issue. Self-patching should be enhanced to use ditto --hfsCompression on each file after the patch is applied on 10.6. Future versions of the OS may or may not support similar technology (that's why there's no API for filesystem-level compression).

On first launch, Firefox could detect it's on 10.6 and synthesize a phantom patchset that applies to every file with 0 diffs, which should have the side effect of compressing files afterward.

However, if your launch time is really affected by this in a substantial way, there are probably things you can do to improve the footprint without resorting to filesystem compression, like using order files, or making sure you put read-only data in the text segment so that it only gets paged in on demand.

Also, note that filesystem-level compression is HFS+-specific, and will not work on other filesystems, and indeed since it is a system implementation detail, may not work in the way you expect it to in the future.

Shantonu Sen
ss...@apple.com

Sent from my Mac Pro

On Jan 27, 2010, at 1:03 AM, Jean-Daniel Dupas wrote:

>
> Le 27 janv. 2010 à 09:34, Joel Reymont a écrit :
>
>>
>> On Jan 27, 2010, at 8:29 AM, Jean-Daniel Dupas wrote:
>>
>>> wrong, partial update do not prevents codesign. Especially as the partial update can contains the updated code signature.
>>
>> Can partial updates preserve compression on Snow Leopard?
>>
>> How does Apple do this?
>>
>> In other words, can we deliver a compressed Firefox for Snow Leopard -and- deliver compressed updates as well? I gather that the objection is to compress Firefox post-installation.
>>
>
> Apple uses pkg to distribute their software and their updates. They don't have to support system older than the target one (as they distribute one package by major version if when needed), and the pkg format supports HFS compression (a class-dump of the private PackageKit reveal a useHFSPlusCompression property in PKPackageInfo), but as I avoid pkg as much as I can, I don't know if this is a public features and how to use it.
>
>
> -- Jean-Daniel
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-dev mailing list (Darwi...@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:

_______________________________________________

Damien Sorresso

unread,
Jan 27, 2010, 11:32:20 AM1/27/10
to Joel Reymont, darwin-dev@lists.apple.com Dev
On Jan 26, 2010, at 11:47 PM, Joel Reymont wrote:
> On Jan 27, 2010, at 7:44 AM, Damien Sorresso wrote:
>> By doing this, you're basically guaranteeing that Firefox can never participate in the code signing model. Maybe you don't care right now, but then again, maybe one day you'll want to use the Keychain APIs.
>
> I don't think it's a concern for now. That said, what is the best option of compressing Firefox on Snow Leopard? Ditto launched from a separate app using Launchd APIs?


The launchd APIs you're referring to are undocumented, and we generally discourage their use for anything but checking in to get a socket file descriptor.


--
Damien Sorresso
BSD Engineering
Apple Inc.

_______________________________________________

Damien Sorresso

unread,
Jan 27, 2010, 11:54:17 AM1/27/10
to Joel Reymont, darwin-dev@lists.apple.com Dev
On Jan 27, 2010, at 12:21 AM, Joel Reymont wrote:
> Damien,
>
> On Jan 27, 2010, at 7:44 AM, Damien Sorresso wrote:
>
>> By doing this, you're basically guaranteeing that Firefox can never participate in the code signing model.
>
> Firefox download partial updates right now, including binary code. It kicks off the updater once the download is done and updates itself. This prevents Firefox from participating in the code signing model so compression would not be much different.

With a partial update, you can update the code signature. You are talking about generated a new executable at launch-time and exec(3)ing that. That is different. Regardless of where it lives, the code that's executing will not be signed.

> What are the huge benefits to participating in code signing?

You attach a reliable identity to a piece of code.

>> Maybe you don't care right now, but then again, maybe one day you'll want to use the Keychain APIs.
>
> Is code signing a must to use the Keychain APIs? Can you please clarify?

You can update your application without the Keychain nagging the user that it has changed (as long as the signature is intact). Also, the ServiceManagement framework uses code signing to establish a handshake between an unprivileged application and a privileged helper tool that it's trying to install.

If Firefox gets a launch-time benefit from compression, it implies that Firefox's executable is structured in such a way that, when the kernel maps it in, it has to do a lot more work upfront than is normal. The overhead of decompressing the executable should exceed that of just launching it directly. After all, the HFS compression stuff was developed for files that are infrequently accessed, not hot files.


--
Damien Sorresso
BSD Engineering
Apple Inc.

_______________________________________________

Reply all
Reply to author
Forward
0 new messages