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

DDI: change suffix to .gpt #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

keszybz
Copy link
Member

@keszybz keszybz commented Nov 17, 2023

Follow-up to 68dd1d9: the extension ".raw" is not ideal:

  • it is too generic: there are simply too many things which are "raw", and different people will have different expectations, and an extension should be unique.
  • a DDI is not actually "raw". It has a header with a partition table, so it's a well-defined binary container format. "Raw" would normally be used for file with just contains unadorned data, without a header or other means of understanding the contents without context. Once you take the exact same data, but wrap a header around it that describes the data, the file contents are not "raw".

Semantic Line Breaks à la https://sembr.org/ are used.

Follow-up to 68dd1d9:
the extension ".raw" is not ideal:
- it is too generic: there are simply too many things which are "raw",
  and different people will have different expectations, and an
  extension should be unique.
- a DDI is not actually "raw". It has a header with a partition table,
  so it's a well-defined binary container format. "Raw" would normally
  be used for file with just contains unadorned data, without a header
  or other means of understanding the contents without context. Once
  you take the exact same data, but wrap a header around it that
  describes the data, the file contents are not "raw".

Semantic Line Breaks à la https://sembr.org/ are used.
@bluca
Copy link
Member

bluca commented Nov 17, 2023

Nonono very hard no. I just spent ~4 years switching everything from what I had before to .raw as @poettering wanted (it's not even fully finished yet). It required an astonishing amount of work from several departments and groups. I am not going to switch again.

@keszybz
Copy link
Member Author

keszybz commented Nov 18, 2023

That's why such things should be discussed publicly first. When an implementation is created internally, then it's subject to change later. But anyway, I don't think you actually have to change anything internally. This is just a recommendation after all, and you can use .raw or anything else internally without any problem.

@bluca
Copy link
Member

bluca commented Nov 18, 2023

It was discussed publicly, on various systemd PRs and issues. Not here obviously because this org didn't even exist at the time. But it is the standard now and it cannot change, as it's an established API.

@keszybz
Copy link
Member Author

keszybz commented Nov 18, 2023

It was discussed publicly, on various systemd PRs and issues. Not here obviously because this org didn't even exist at the time. But it is the standard now and it cannot change, as it's an established API.

Of course it can be changed. The old suffix would have to be honoured, but that's no problem. (I think that in most places we don't care about the suffix at all, but there are some places where we enumerate things.) As far as transitions go, this should be a very easy one.

@bluca
Copy link
Member

bluca commented Nov 18, 2023

No, because then tooling would start to drop support for the existing one, or new tooling would not even add it, breaking all existing use cases, for example all image creation tools would stop using the existing suffix and create incompatible images.

@poettering
Copy link
Collaborator

poettering commented Nov 20, 2023

We had this discussion back at LPC in Dublin last year already, with you @keszybz. Back then we already more or less came to the conclusion that the ship has sailed on the .raw suffix, it's too much established already, and our codebase only cares for that suffix, for example the code in src/shared/discover-image.c only knows how to deal with that suffix, and so does nspawn and so on. (they'll take file wit any suffix, but only if the suffix is .raw know how to chop it off correctly to get a default hostname and such)

Our compromise back then was to introduce secondary suffixes though, i.e. .confext.raw and .sysext.raw. I think that's a nice approach. i.e. the primary suffix .raw indicates this is a disk image, and the secondary suffix indicates what's in it.

I added code for dealing with these secodnary suffix to discover-image.c in the past months btw. I think with v255 we should be reasonably complete on that.

the uefi forum people registered with IANA that GPT disk images should have a mime type of "application/vnd.efi.img" btw, and at the same time registered a suffix for the files: .img. See https://www.iana.org/assignments/media-types/application/vnd.efi.img.

.img is of course as bad a suffix as .raw is I guess.

XDG shared-mime-info (i.e. the thing file manages on gnome/kde/… use to identify file types) implements the IANA definition btw. I recently filed this to make this more compatible with our images: https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/276

Anyway, I think we should stick to the .raw suffix, and maybe extend the secondary suffix thing. i.e. we could also add .portable.raw (or .psvc.raw or so) for portable services. and .os.raw (or .machine.raw) for bootable container/baremetal systems?

At the same time we should continue to support image names without the secondary suffixes, with only primary suffix to support multi-modal images, i.e. images that are both confext and sysext, or images that are both portable services and OS images.

@poettering
Copy link
Collaborator

We might want to define proper mime types for our secondary suffixes btw (not for .raw, because too generic), maybe even register with iana, but I am too lazy for that bureaucracy, and just use one of those x mime types

@keszybz
Copy link
Member Author

keszybz commented Nov 24, 2023

Yeah, we discussed this and I regret not pushing harder against this extension. I didn't realize that this will be visible in so many places. As long as this was internal to our implementation, it didn't matter so much. But documenting this as the one and only extension makes this more visible and problematic.

the uefi forum people registered with IANA that GPT disk images should have a mime type of "application/vnd.efi.img" btw, and at the same time registered a suffix for the files: .img. See https://www.iana.org/assignments/media-types/application/vnd.efi.img.

.img is not a great extension, because it's so generic. I think it's marginally better than .raw.

(FWIW, the description on the iana page is terrible: it doesn't even mention GPT anywhere.)

Anyway, I think we should stick to the .raw suffix, and maybe extend the secondary suffix thing. i.e. we could also add .portable.raw (or .psvc.raw or so) for portable services. and .os.raw (or .machine.raw) for bootable container/baremetal systems?

OK, so if .raw is so widespread, it should be supported. But what about adding an alternative suffix? I think either .gpt or .ddi would be OK. E.g. .confext.ddi is very informative.

@poettering
Copy link
Collaborator

So I am not convinced this is really necessary, but I am also not totally against it, if these suffixes are supported as an alternative in our codebase. But please prep the systemd commit for this at the same time, as I am really not a fan of specs that have no footing in reality.

@bluca
Copy link
Member

bluca commented Dec 7, 2023

If you add alternatives, it adds to the confusion, and you start getting things that implement one and not the other. Given it's a cosmetic thing and it has shipped already, I don't think it brings in much value, but just increases the chances things will stop working one way or the other. For example, if you are on existing versions of systemd, you won't be able to load any of these. It will get confusing for developers and confusing for users.

@poettering
Copy link
Collaborator

.gpt is not a great suffix btw, .ddi would be much better. but still, I am not convinced this all is really necessary.

@sonukaloshiya

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants