Skip to content
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

Fix VBScript error where a drive has duplicate drive letters #130

Merged
merged 1 commit into from Jan 12, 2017

Conversation

jviotti
Copy link
Contributor

@jviotti jviotti commented Jan 12, 2017

We've encountered a case where a different partitions of a single drive
were reported to have the exact same drive letter. This is obviously
weird unexpected behaviour in the first case, which seems to have
accidentally caused while manually fiddling with drive letters (maybe a
Windows bug?).

In any case, the symptom of the issue was the following error:

Microsoft VBScript runtime error: This key is already associated with an
element of this collection

We have our own List data structure based on Scripting.Dictionary,
which will complain with the error above if we try to set a key that
already exists.

Checking if an element already exists in the list is sadly not an easy
venture (mainly when dealing with non-scalar types). As a solution,
we've implemented a Has() method that only works with scalar types
(for now), and use that to decide whether we add a drive letter to the
list of mount-points or not.

See: balena-io/etcher#1004 (comment)
Signed-off-by: Juan Cruz Viotti jviotti@openmailbox.org

We've encountered a case where a different partitions of a single drive
were reported to have the exact same drive letter. This is obviously
weird unexpected behaviour in the first case, which seems to have
accidentally caused while manually fiddling with drive letters (maybe a
Windows bug?).

In any case, the symptom of the issue was the following error:

```
Microsoft VBScript runtime error: This key is already associated with an
element of this collection
```

We have our own `List` data structure based on `Scripting.Dictionary`,
which will complain with the error above if we try to set a key that
already exists.

Checking if an element already exists in the list is sadly not an easy
venture (mainly when dealing with non-scalar types). As a solution,
we've implemented a `Has()` method that only works with scalar types
(for now), and use that to decide whether we add a drive letter to the
list of mount-points or not.

See: balena-io/etcher#1004 (comment)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
@jviotti jviotti merged commit c23daf4 into master Jan 12, 2017
@jviotti jviotti deleted the duplicate-windows-drive-letters branch January 12, 2017 15:56
jviotti pushed a commit to balena-io/etcher that referenced this pull request Jan 12, 2017
- balena-io-modules/drivelist#130

Change-Type: patch
Changelog-Entry: Fix "This key is already associated with an element of this collection" error when multiple partitions point to the same drive letter on Windows.
Fixes: #1004
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
jviotti pushed a commit to balena-io/etcher that referenced this pull request Jan 12, 2017
- balena-io-modules/drivelist#130

Change-Type: patch
Changelog-Entry: Fix "This key is already associated with an element of this collection" error when multiple partitions point to the same drive letter on Windows.
Fixes: #1004
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant