10000 Merging throws `TypeError: Cannot read properties of undefined (reading 'toString')` · Issue #838 · EPICLab/synectic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Merging throws TypeError: Cannot read properties of undefined (reading 'toString') #838

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

Closed
nelsonni opened this issue Jul 1, 2022 · 1 comment
Assignees
Labels
bug Bug reports or bug fixes

Comments

@nelsonni
Copy link
Member
nelsonni commented Jul 1, 2022

Describe the bug
When merging linked-worktree branches, the subsequent dispatching of updateVersionedMetafile thunks requires calling getStatus in order to verify the correct git status on all metafiles involved in the merge.

However, the following error is thrown during one instance of that call:

TypeError: Cannot read properties of undefined (reading 'toString')
    at module.exports.readUIntBE (read-uint.js?b97d:29:1)
    at eval (binarnia.js?83b1:145:1)
    at currify (currify.js?7a3a:16:1)
    at again (currify.js?7a3a:19:1)
    at eval (currify.js?7a3a:7:25)
    at module.exports (binarnia.js?83b1:38:1)
    at parseEntry (git-index.ts?c01d:140:10)
    at parseEntries (git-index.ts?c01d:128:19)
    at parse (git-index.ts?c01d:151:19)
    at eval (git-worktree.ts?6a8b:182:22)

To Reproduce
Steps to reproduce the behavior:

  1. Launch Synectic
  2. Go to FileOpen...
  3. Select the root directory of a repository with at least two branches that reside in linked worktrees
  4. Go to ActionMerge...
  5. Select the Repository from the drop-down menu
  6. Select Base and Compare branches that reside in linked worktrees from the drop-down
  7. Select the Merge button
  8. Wait for the merge process to complete
  9. See error

Expected behavior
A merge is cleanly executed, or halted and merge conflicts are displayed so that the user can handle them.

Screenshots
image

Versions (please complete the following information):

  • OS: MacOS, Windows, Linux
  • Synectic Version: 2.0.0

Additional context
Add any other context about the problem here.

@nelsonni nelsonni added the bug Bug reports or bug fixes label Jul 1, 2022
@nelsonni nelsonni self-assigned this Jul 1, 2022
@nelsonni
Copy link
Member Author

The errors caught in console indicated that module.exports.readUIntBE (read-uint.js?b97d:29:1) was the root location of the error. The readUIntBE function is provided by the read-uint module, which is included in the binarnia module that we use for parsing git index files.

Since these modules are written in JavaScript, it is difficult to analyze where an undefined type is being introduced. To help, I re-implemented binarnia in TypeScript as git-binarnia, read-uint as git-read-uint, and currify as git-curry. This allowed me to determine that the process of using readUIntBE() was encountering issues when reading filePathSize for files that contained merge conflicts. This exclusively occurs in git index file associated with branches that contain merge conflicts.

An example of this would be when attempting to merge task-1-base and task-1-compare branches in the EPICLab/ant-design repository. The resulting execution of git-worktree.status throws a similar error because the filePathSize of the ../.syn/ant-design/task-1-base/components/rate/index.tsx is found to be 1012 bits instead of the more common 10-30 bit lengths. This results in the subsequent filePath (which uses filePathSize to determine how much of the index buffer to read) containing additional junk characters.

@nelsonni nelsonni changed the title Merging throws TypeError: Cannot read properties of undefined (reading 'toString') Merging throws TypeError: Cannot read properties of undefined (reading 'toString') Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports or bug fixes
Projects
None yet
Development

No branches or pull requests

1 participant
0