log why the permission is denied
Posted Jan 25, 2013 4:17 UTC (Fri) by
skissane (subscriber, #38675)
In reply to:
log why the permission is denied by ebiederm
Parent article:
Making EPERM friendlier
Well, you can't just use the English text as-is. You actually have to use the English text with substitution variables, e.g. "File %s not found", and then pass the substitution variables separately - so passing a single string variable from user-space doesn't work very well, you'd need to do something like pass a structure containing the format string and the arguments to go with it...
And, while this approach is popular with e.g. the gettext API, I see a couple of drawbacks:
- Assigning numeric error IDs helps: if a non-English user needs help from an English-speaking resource, the English-speaker can quickly identify the error if a numeric code is included; otherwise, off to Google translate
- What if the English message in the kernel has bad spelling or grammar? Well, you don't want to change it now, its part of the user-space ABI. If the kernel was to pass a numeric error code to user space, the English text can be corrected much more easily
(
Log in to post comments)