Open Bug 1690326 Opened 4 months ago Updated 9 days ago

Add mappings for NS_ERROR_MODULE_WIN32 errors generated from nsLocalFileWin.cpp

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

ASSIGNED

People

(Reporter: sg, Assigned: jstutte)

References

(Blocks 2 open bugs)

Details

(Keywords: leave-open)

Attachments

(4 files)

The NS_ERROR_MODULE_WIN32 errors actually generated from nsLocalFileWin.cpp should eventually be mapped to platform-agnostic error codes.

One candidate error code to be added is 0x570 ERROR_FILE_CORRUPT. We already have NS_ERROR_FILE_CORRUPTED, but we use it probably at a higher level of abstraction (reading a file whose content we don't understand wrt the expected content, like jar). As 0x570 ERROR_FILE_CORRUPT needs probably different actions (it is a strong indicator of file system corruption) than dealing with a file we might have wrecked ourself, I'd propose a new NS_ERROR_FILE_OS_CORRUPT. Ideas for a better naming are welcome!

While NS_ERROR_FILE_CORRUPTED already exists, it indicates most of the times more a parsing problem of a given file format.
But Windows ERROR_FILE_CORRUPTED signals a malfunctioning or corrupted file system at OS level, thus we translate it to the new
NS_ERROR_FILE_FS_CORRUPTED.

There seems to be no suitable errno under POSIX to map here.

Assignee: nobody → jstutte
Status: NEW → ASSIGNED
Attachment #9209758 - Attachment description: Bug 1690326: Map Windows error 0x570 ERROR_FILE_CORRUPT to NS_ERROR_FILESYSTEM_CORRUPTED r?sg,#xpcom-reviewers → Bug 1690326: Map Windows error 0x570 ERROR_FILE_CORRUPT to NS_ERROR_FILE_FS_CORRUPTED r?sg,#xpcom-reviewers
Keywords: leave-open
Attachment #9209758 - Attachment description: Bug 1690326: Map Windows error 0x570 ERROR_FILE_CORRUPT to NS_ERROR_FILE_FS_CORRUPTED r?sg,#xpcom-reviewers → Bug 1690326: Map Windows error 0x570 ERROR_FILE_CORRUPT to NS_ERROR_FILE_FS_CORRUPTED r?janv,#xpcom-reviewers
Pushed by jstutte@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5cd1ef556cbc
Map Windows error 0x570 ERROR_FILE_CORRUPT to NS_ERROR_FILE_FS_CORRUPTED r=xpcom-reviewers,janv,nika
Blocks: 1704495
No longer blocks: 1704495
See Also: → 1704495

WIN32(0x45D) is ERROR_IO_DEVICE seems to happen in the wild, too.

See Also: → 1704439
See Also: → 1704438
Pushed by jstutte@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2899639c5db8
Map Windows error 0x45D ERROR_IO_DEVICE to NS_ERROR_FILE_DEVICE_FAILURE r=janv,xpcom-reviewers,mccr8
See Also: → 1706006

Looking at what I can map ERROR_DISK_FULL in ConvertWinError I was wondering, if ERROR_DISK_FULL and/or ERROR_HANDLE_DISK_FULL should really map to NS_ERROR_FILE_TOO_BIG, which sounds meaningful to me only in case we are writing a (large) file. And the only place we intercept NS_ERROR_FILE_TOO_BIG seems to deal with 32Bit limitations while reading, not with the disk full case.

The code which depends on the old generic NS_ERROR_MODULE_WIN32 mapping needs
to be updated too.

Depends on D113505

See Also: → 1705304
Pushed by jvarga@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a98b826be2d8
Follow-up fix for the ERROR_FILE_CORRUPT to NS_ERROR_FILE_FS_CORRUPTED mapping; r=jstutte
See Also: → 1703266

For bug 1704439, comment 7:

0x1E3 seem to have no current mapping in official documentation ? And in winerror.h we only see:

#define MK_E_UNAVAILABLE _HRESULT_TYPEDEF_(0x800401E3L)

whatever MK_E_UNAVAILABLE means (what I read in internet talks about marshaling to office?).

(In reply to Jens Stutte [:jstutte] from comment #13)

For bug 1704439, comment 7:

0x1E3 seem to have no current mapping in official documentation ? And in winerror.h we only see:

#define MK_E_UNAVAILABLE _HRESULT_TYPEDEF_(0x800401E3L)

whatever MK_E_UNAVAILABLE means (what I read in internet talks about marshaling to office?).

I don't think MK_E_UNAVAILABLE has to do with the error. According to net helpmsg 483, the error message for Win32 error code 483 (0x1E3) is "The request failed due to a fatal device hardware error."

(In reply to Jens Stutte [:jstutte] from comment #13)

And in winerror.h

Obviously this is not an official Microsoft repo. I found

//
// MessageId: ERROR_DEVICE_HARDWARE_ERROR
//
// MessageText:
//
// The request failed due to a fatal device hardware error.
//
#define ERROR_DEVICE_HARDWARE_ERROR 483L

in my local Windows SDK installation.

(In reply to Masatoshi Kimura [:emk] from comment #16)

#define ERROR_DEVICE_HARDWARE_ERROR 483L

in my local Windows SDK installation.

Thanks for looking that up! That sounds much more plausible, indeed.

Pushed by jstutte@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d148b4f4821e
Add mappings for ERROR_DEVICE_HARDWARE_ERROR, ERROR_DEVICE_NOT_CONNECTED, ERROR_DISK_FULL and remove error NS_ERROR_FILE_DISK_FULL in favor of existing NS_ERROR_FILE_NO_DEVICE_SPACE r=xpcom-reviewers,necko-reviewers,nika,valentin
Regressions: 1709887
See Also: → 1709957
Blocks: 1703801

There are some new Windows errors. hurray!

Code Meaning Where
0x12 ERROR_NO_MORE_FILES GetNextFile, this might be something we need to handle/expect?
0x1 ERROR_INVALID_FUNCTION GetDirectoryEntries, not sure but we might try to invoke GetDirectoryEntries on a directory that vanished in the meantime?
0x5AA ERROR_NO_SYSTEM_RESOURCES Sounds not very actionable, but is definitely fatal
0x1129 ERROR_REPARSE_TAG_INVALID (The tag present in the reparse point buffer is invalid.) GetDirectoryEntries
0x17 ERROR_CRC Data error (cyclic redundancy check). CopyTo From what I read, it is another form of saying "filesystem corrupt"
No longer blocks: 1703801
Blocks: 1703801
Blocks: 1704440
You need to log in before you can comment on or make changes to this bug.