<div dir="ltr"><div dir="ltr">Hi,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 13, 2023 at 11:02 AM Benjamin Gordon <<a href="mailto:bmgordon@chromium.org">bmgordon@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Mon, Mar 13, 2023 at 11:03 AM Ralph Little <<a href="mailto:skelband@gmail.com" target="_blank">skelband@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>Wanted to get views from the more seasoned devs on this topic.</div><div>The SANE API spec says that Name and Desc for attributes are not valid for options of type SANE_TYPE_GROUP, but is not prescriptive about what those values should be initialized to in those cases.</div><div><br></div><div>My gut says that they should be NULL, but a lot of backends set them to "".</div><div><br></div></div></blockquote><div> </div><div>From the poking around I've done, at least some frontends assume name has a valid pointer in it.  I found a couple where they dereference name without checking if it's NULL at all and others that skip over options that have name == NULL.  scanimage itself falls into the second category in print_options(), so it doesn't print groups unless they have a non-NULL name pointer.  It seems like even if NULL is technically a valid value here, better compatibility with existing frontends is achieved by setting it to "".</div><div><br></div><div>Thanks,</div><div>Benjamin</div><div><br></div></div></div></blockquote><div><br></div>Some clarification in the SANE specification would be helpful here, even if it says that it "must be a valid string but content is not guaranteed to contain anything useful". Given the number of older backends that supply "", it is hard to determine what the originators of the spec had in mind. :(</div><div class="gmail_quote"><br></div><div class="gmail_quote">Cheers,</div><div class="gmail_quote">Ralph<br></div></div>