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

Unexpected behavior with ucp #393

Open
iandulchinos-cpi opened this issue Oct 6, 2023 · 2 comments
Open

Unexpected behavior with ucp #393

iandulchinos-cpi opened this issue Oct 6, 2023 · 2 comments

Comments

@iandulchinos-cpi
Copy link

Using uuu version 1.5.21, but the issue exists on 1.4.139 as well. Haven't tried any other versions.

Copying a file and then copying again with a truncated version of the same file results in extra characters added to the resulting file on the device.

Steps to reproduce

On the PC running uuu, with the device in FBK mode, run

$ echo abcd > /tmp/test.txt
$ uuu FBK: ucp /tmp/test.txt T:/tmp/test.txt
$ echo ab > /tmp/test.txt
$ uuu FBK: ucp /tmp/test.txt T:/tmp/test.txt

Expected contents of /tmp/test.txt on the device:

ab

Actual contents of /tmp/test.txt on the device:

ab
d

Is this a known issue?

@nxpfrankli
Copy link
Contributor

Possible it is bugs.

Can you try

diff --git a/libuuu/buffer.cpp b/libuuu/buffer.cpp
index 7e32a06..0500d6e 100644
--- a/libuuu/buffer.cpp
+++ b/libuuu/buffer.cpp
@@ -239,7 +239,7 @@ public:
                if (p->mapfile(backfile.substr(1), st.st_size))
                        return -1;

-               p->m_available_size = st.st_size;
+               p->m_DataSize = p->m_available_size = st.st_size;

                atomic_fetch_or(&p->m_dataflags, FILEBUFFER_FLAG_LOADED | FILEBUFFER_FLAG_NEVER_FREE);
                p->m_request_cv.notify_all();

@iandulchinos-cpi
Copy link
Author

@nxpfrankli Thank you for the quick response! I added that change on top of the most recent master commit and built, still seeing the issue.

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

No branches or pull requests

2 participants