Skip to content

littlefs: Map LFS_ERR_CORRUPT to EILSEQ #6772

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

Merged
merged 1 commit into from
May 23, 2018
Merged

littlefs: Map LFS_ERR_CORRUPT to EILSEQ #6772

merged 1 commit into from
May 23, 2018

Conversation

geky
Copy link
Contributor

@geky geky commented Apr 29, 2018

Description

Previously EBAD (invalid exchange), mapping the error CORRUPT to EILSEQ (illegal byte sequence) makes more sense as a description of the type of error.

Will change the underlying error code inside littlefs on the next major version.

related #6336
cc @davidsaada, @kjbracey-arm, @deepikabhavnani

TODO

  • will squash

Pull request type

[ ] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[✗] Breaking change

@geky
Copy link
Contributor Author

geky commented Apr 29, 2018

Added "do not merge" until removed from #6336 as they should go in together. I only want one release with error code changes.

@geky geky closed this Apr 29, 2018
@geky
Copy link
Contributor Author

geky commented Apr 29, 2018

woops wrong button

@geky geky reopened this Apr 29, 2018
@kjbracey
Copy link
Contributor

kjbracey commented Apr 30, 2018

Little bit doubtful about EILSEQ because it is a quite new error originally defined by later C standards for multibyte text encodings. Not sure what the more traditional alternative would be, so probably fine.

Copy link
Contributor

@kegilbert kegilbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with EILSEQ for a corruption error code. LGTM after squashing the extra commit.

deepikabhavnani
deepikabhavnani previously approved these changes May 1, 2018
@geky
Copy link
Contributor Author

geky commented May 1, 2018

@kjbracey-arm I wanted to run this by you because I don't know a better errno code and have been looking for the past year or so. EBADE is used for SSL connection failures, but as far as static storage goes any sort of corruption detection in the OSs I've looked at are just returning as EIO.

But in our case, differentiating between a bus/driver issue and a corruption issue is important. Especially looking at security with respect to storage. I'm open to thoughts.

@kjbracey
Copy link
Contributor

kjbracey commented May 2, 2018

@geky I earlier had a bit of search, trying to find out what mount/directory reads etc would traditionally do in Unices if presented with duff data, and like you didn't find any obvious answer.

Looking again at some old 4.4BSD source I have handy, I can see ISO CD mounting returning EINVAL, but UFS and similar seem to just use EIO. So they're either confused with device errors or user errors.

Hmph. Looks like something of a POSIX and predecessors omission.

Spreading a bit wider than POSIX, QNX has EBADFSYS and AIX has ECORRUPT.

I'd be kind of tempted to add add EBADFSYS.

kjbracey
kjbracey previously approved these changes May 2, 2018
Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving cos I don't have a clearly better suggestion.

@cmonr
Copy link
Contributor

cmonr commented May 8, 2018

Spreading a bit wider than POSIX, QNX has EBADFSYS and AIX has ECORRUPT.
I would prefer one of these over EILSEQ, but don't feel strongly enough about it one way or another.

All three options are definitely a bit better than EBAD.

@cmonr
Copy link
Contributor

cmonr commented May 14, 2018

@geky Do you still need to squash before we start CI?

Previously EBAD (invalid exchange), mapping the error CORRUPT to EILSEQ
(illegal byte sequence) makes more sense as a description of the type of
error.
@geky geky dismissed stale reviews from kjbracey and deepikabhavnani via 2697ebe May 14, 2018 19:13
@geky geky force-pushed the g-littlefs-eilseq branch from d9b2045 to 2697ebe Compare May 14, 2018 19:13
@geky
Copy link
Contributor Author

geky commented May 14, 2018

Done and done. Barring and major complaints, I think we should go ahead with EILSEQ.

@cmonr
Copy link
Contributor

cmonr commented May 14, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented May 14, 2018

Build : SUCCESS

Build number : 2014
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6772/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented May 15, 2018

Test : SUCCESS

Build number : 1824
Test logs :http://mbed-os-logs.s3-website-us-west-1.amazonaws.com/?prefix=logs/6772/1824

@mbed-ci
Copy link

mbed-ci commented May 15, 2018

@cmonr
Copy link
Contributor

cmonr commented May 17, 2018

Holding off on merging until 5.8.5 is in.
Will bring in around same time that #6336 is brought in.

needs #6336

@0xc0170
Copy link
Contributor

0xc0170 commented May 22, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented May 22, 2018

Build : FAILURE

Build number : 2101
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6772/

@cmonr
Copy link
Contributor

cmonr commented May 22, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented May 23, 2018

Build : SUCCESS

Build number : 2111
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6772/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented May 23, 2018

@mbed-ci
Copy link

mbed-ci commented May 23, 2018

@geky
Copy link
Contributor Author

geky commented May 23, 2018

@cmonr LGTM?

@cmonr
Copy link
Contributor

cmonr commented May 23, 2018

Ooh! It's done!

Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cmonr cmonr merged commit eb9435b into master May 23, 2018
@geky
Copy link
Contributor Author

geky commented May 23, 2018

https://media.giphy.com/media/hpfInSxkkLdpS/giphy.gif

@geky geky deleted the g-littlefs-eilseq branch May 30, 2018 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants