timbertson / gup

A better make, inspired by djb's redo.
GNU Lesser General Public License v2.1
51 stars 5 forks source link

windows: consistent os.path.relpath() crash #17

Open rbrewer123 opened 4 years ago

rbrewer123 commented 4 years ago

When running on Windows, gup consistently crashes due to an exception raised by os.path.relpath(). This happens when I add a dependency that is on a separate drive letter from the drive where my Gupfile is located.

Playing around a little at the Python3 repl on both Linux and Windows, it appears Linux can generate a new relative path from anywhere in the filesystem by traversing /, so os.path.relpath() raises no exceptions for wildly different paths. On Windows, os.path.relpath() raises an exception when the drive letters are different, e.g. C: vs. H:, or when the UNC hosts are different, e.g. \\host1\foo vs. \\host2\bar.

My temporary workaround is to not add cross-drive dependencies in my project.

timbertson commented 4 years ago

What's the exception? Do you have a stack trace?

On Fri, 20 Dec 2019, 10:56 pm Rob Brewer, notifications@github.com wrote:

When running on Windows, gup consistently crashes due to an exception raised by os.path.relpath(). This happens when I add a dependency that is on a separate drive letter from the drive where my Gupfile is located.

Playing around a little at the Python3 repl on both Linux and Windows, it appears Linux can generate a new relative path from anywhere in the filesystem by traversing /, so os.path.relpath() raises no exceptions for wildly different paths. On Windows, os.path.relpath() raises an exception when the drive letters are different, e.g. C: vs. H:, or when the UNC hosts are different, e.g. \host1\foo vs. \host2\bar.

My temporary workaround is to not add cross-drive dependencies in my project.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timbertson/gup/issues/17?email_source=notifications&email_token=AAADOXF6ADV2X4AS5MCQQXLQZSXH7A5CNFSM4J547DP2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IB6MIRA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADOXHA4OBFXPIOTBWHED3QZSXH7ANCNFSM4J547DPQ .

rbrewer123 commented 4 years ago

I'll work on getting a stack trace. The exception is ValueError: path is on mount 'c:', start on mount 'h:'. The underlying ntpath.relpath() raises the exception on Linux too.

timbertson commented 4 years ago

Thanks, that should be enough to work with

On Sun, 22 Dec 2019, 1:03 am Rob Brewer, notifications@github.com wrote:

I'll work on getting a stack trace. The exception is ValueError: path is on mount 'c:', start on mount 'h:'. The underlying ntpath.relpath() raises the exception on Linux too.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/timbertson/gup/issues/17?email_source=notifications&email_token=AAADOXCHCYWQGC5GZRSPEG3QZYO35A5CNFSM4J547DP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHO4UFY#issuecomment-568183319, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADOXHIVDWWZAS3SXFEDCTQZYO35ANCNFSM4J547DPQ .