alex / rply

An attempt to port David Beazley's PLY to RPython, and give it a cooler API.
BSD 3-Clause "New" or "Revised" License
381 stars 60 forks source link

parsergenerator.build fails on a read-only filesystem #74

Closed Kodiologist closed 6 years ago

Kodiologist commented 6 years ago

See hylang/hy#1598.

alex commented 6 years ago

Is there a stacktrace for exactly what lines are triggering this error?

dsevero commented 6 years ago

@alex yes: https://github.com/hylang/hy/issues/1598#issuecomment-386064932

alex commented 6 years ago

Whoops, missed that it wasn't unfurled by default.

If someone wants to write a patch to catch OSError and check if e.errno == errno.EROFS I'd accept that patch.

alex commented 6 years ago

Actually, I'll write it myself, since I want to refactor something.

Kodiologist commented 6 years ago

As well, I would be inclined to add an argument to builds to disable the cache in case it isn't desired in the first place.

alex commented 6 years ago

You can pass cache_id=None to the constructor to disable it.

alex commented 6 years ago

Whoops, accidentally commited directly to master instead of sending a PR: https://github.com/alex/rply/commit/2a3f626081bfe1369c679a51910b4bbc73340268

Feedback welcome

Kodiologist commented 6 years ago

You can pass cache_id=None to the constructor to disable it.

Oh, I missed that, thanks.

Feedback welcome

Shouldn't the calls to tempfile.NamedTemporaryFile and os.rename be guarded, too?

alex commented 6 years ago

In case the directory exists, but is on a read-only file system?

My inclination is that if you have an rply directory in your user cache dir, but now that's on a read-only-fs, it's probably a bug and I'd rather be noise.

Kodiologist commented 6 years ago

I'm not sure what the exact scenario would be, but IO carries inherent risk (race conditions etc.) and this isn't an essential operation (if cache writing fails, everything else about rply can still work), so I would catch all IO and OS errors here, perhaps with a warning. Similarly, it probably isn't enough to catch only errno.EROFS for directory creation. I don't think AWS Lambda raises that errno, for example.

dsevero commented 6 years ago

Is there any way I could bypass this problem, even if it's not the best solution?

Kodiologist commented 6 years ago

Why not use the new fix, instead of a workaround?

Kodiologist commented 6 years ago

@alex Could you make a new release of rply soon so we can get this fix into the next release of Hy?

alex commented 6 years ago

I'd like to try to get rpython fixes into the next release; @cfbolz said he was hoping to work on them soonish, so hopefully I'll be able to throw together a release next weekend, does that work?

On Sun, May 20, 2018 at 4:43 PM Kodi Arfer notifications@github.com wrote:

@alex https://github.com/alex Could you make a new release of rply soon so we can get this fix into the next release of Hy?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alex/rply/issues/74#issuecomment-390510984, or mute the thread https://github.com/notifications/unsubscribe-auth/AAADBOFn1-uzorUrch3FZDYmabMnzRJxks5t0dV7gaJpZM4Tv5Ez .

-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: D1B3 ADC0 E023 8CA6

Kodiologist commented 6 years ago

Sure, I doubt Hy will release before mid-June.

alex commented 6 years ago

Sounds good, I'll aim for a release next week, and if for any reason I don't have one out by the time you're ready for a Hy release, let me know and I'll just do it.

On Sun, May 20, 2018 at 4:48 PM Kodi Arfer notifications@github.com wrote:

Sure, I doubt Hy will release before mid-June.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alex/rply/issues/74#issuecomment-390511310, or mute the thread https://github.com/notifications/unsubscribe-auth/AAADBDa9UvmCcmU6_-DoiPHZ2urgmtFTks5t0daZgaJpZM4Tv5Ez .

-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: D1B3 ADC0 E023 8CA6

Kodiologist commented 6 years ago

Actually, I've made a Hy PR to disable the cache (hylang/hy#1615) because it doesn't seem to give a noticeable performance boost, anyway. So, this should be a non-issue.

alex commented 6 years ago

Well, I'm jealous of you then. I added the cache support because building topaz's parser took like 30 seconds.

On Mon, May 21, 2018 at 12:24 PM Kodi Arfer notifications@github.com wrote:

Actually, I've made a Hy PR to disable the cache (hylang/hy#1615 https://github.com/hylang/hy/pull/1615) because it doesn't seem to give a noticeable performance boost, anyway. So, this should be a non-issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alex/rply/issues/74#issuecomment-390705989, or mute the thread https://github.com/notifications/unsubscribe-auth/AAADBPAOJTrVJBLSAgDy72SANT8TI8zVks5t0upHgaJpZM4Tv5Ez .

-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: D1B3 ADC0 E023 8CA6

Kodiologist commented 6 years ago

I bet that Lisp is a lot easier to parse than Ruby. :)

alex commented 6 years ago

Understatement of the century :-)

On Mon, May 21, 2018 at 12:28 PM Kodi Arfer notifications@github.com wrote:

I bet that Lisp is a lot easier to parse than Ruby. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alex/rply/issues/74#issuecomment-390707159, or mute the thread https://github.com/notifications/unsubscribe-auth/AAADBDaO8GBEOyP1_TxF1eyMJRTxbAssks5t0us9gaJpZM4Tv5Ez .

-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: D1B3 ADC0 E023 8CA6

alex commented 6 years ago

I did a release