darcs

Patch 2208 setCurrentDirectory: call error if argum... (and 2 more)

Title setCurrentDirectory: call error if argum... (and 2 more)
Superseder Nosy List bfrk
Related Issues
Status accepted Assigned To
Milestone

Created on 2021-07-08.18:55:00 by bfrk, last changed 2023-03-24.23:21:48 by ganesh.

Files
File name Status Uploaded Type Edit Remove
document-isvalidlocalpath-checks-in-d_r_rebase.dpatch bfrk, 2023-03-22.23:10:57 application/x-darcs-patch
patch-preview.txt bfrk, 2021-07-08.18:54:59 text/x-darcs-patch
patch-preview.txt bfrk, 2023-03-22.23:10:57 text/x-darcs-patch
setcurrentdirectory_-call-error-if-argument-is-a-remote-url.dpatch bfrk, 2021-07-08.18:54:59 application/x-darcs-patch
See mailing list archives for discussion on individual patches.
Messages
msg22906 (view) Author: bfrk Date: 2021-07-08.18:54:59
This fixes the Windows regression I mentioned on IRC that was flagged by our
CI. It turned out that the bug is not Windows specific at all, it's just
that on Windows setCurrentDirectory with a http URL fails because that is
not a valid path name. Calling error in such cases lets us catch this when
testing on Linux, too.

A more principled solution would be to parse arguments that denote a repo
location immediately in the frontend and use the parsed form in the rest of
the code instead of the raw string.

3 patches for repository http://darcs.net/screened:

patch d7a11386d72441f3a00aa876360bdd8de21f3b4e
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Jul  8 10:33:14 CEST 2021
  * setCurrentDirectory: call error if argument is a remote URL

patch 46c59a13b975e80ed869082745f09b423a4febee
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sun Feb 28 11:44:48 CET 2021
  * fix in checkSuspendedStatus and maybeDisplaySuspendedStatus

  We must not try to access either of the rebase patch files if the repo
  location is a remote URL.

patch b2775f40b6521e2df3f555361b4ff9de6f4fc25c
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Jul  8 20:37:14 CEST 2021
  * HasCallStack: withCurrentDirectory, withRepoDir
Attachments
msg23147 (view) Author: ganesh Date: 2023-03-18.20:30:19
Looks good - one question:

>   * fix in checkSuspendedStatus and maybeDisplaySuspendedStatus

>  We must not try to access either of the rebase patch files if the repo
>  location is a remote URL.

Are there scenarios in which we call these functions for a remote repo?
Maybe those could be explained in a comment on the `isValidLocalPath`
guards if so.
msg23156 (view) Author: bfrk Date: 2023-03-21.18:29:57
>>    * fix in checkSuspendedStatus and maybeDisplaySuspendedStatus
> 
>>   We must not try to access either of the rebase patch files if the repo
>>   location is a remote URL.
> 
> Are there scenarios in which we call these functions for a remote repo?

Definitely maybeDisplaySuspendedStatus, it is call at the end of every 
RepoJob; think `darcs log --repo=...`, which IIRC made me stumble over this. 
Will add a comment.

checkSuspendedStatus is only called at the start of RebaseJob and 
RebaseAwareJob, so certainly not for repos at remote URLs. So this check is 
defensive and could be removed. Do you think I should?
msg23158 (view) Author: ganesh Date: 2023-03-21.20:57:32
> Definitely maybeDisplaySuspendedStatus, it is call at
> the end of every RepoJob; think `darcs log --repo=...`,
> which IIRC made me stumble over this. Will add a comment.

> checkSuspendedStatus is only called at the start of
> RebaseJob and RebaseAwareJob, so certainly not for
> repos at remote URLs. So this check is defensive and
> could be removed. Do you think I should?

No, it's fine to keep it, I was just surprised about both
cases. I think just documenting that it's defensive
would work.
msg23168 (view) Author: bfrk Date: 2023-03-22.23:10:57
Following up on review.

1 patch for repository http://darcs.net/screened:

patch 74049ba04f353c3d2afc1ac0d7ae66feacc2092d
Author: Ben Franksen <ben.franksen@online.de>
Date:   Wed Mar 22 23:33:50 CET 2023
  * document isValidLocalPath checks in D.R.Rebase
Attachments
History
Date User Action Args
2021-07-08 18:55:00bfrkcreate
2021-07-08 18:56:37bfrksetstatus: needs-screening -> needs-review
2023-03-18 20:30:21ganeshsetstatus: needs-review -> review-in-progress
messages: + msg23147
2023-03-21 18:29:57bfrksetmessages: + msg23156
2023-03-21 20:57:32ganeshsetmessages: + msg23158
2023-03-22 23:10:57bfrksetfiles: + patch-preview.txt, document-isvalidlocalpath-checks-in-d_r_rebase.dpatch
messages: + msg23168
2023-03-22 23:28:05ganeshsetstatus: review-in-progress -> accepted-pending-tests
2023-03-24 23:21:48ganeshsetstatus: accepted-pending-tests -> accepted