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

[BUG]unit-test for hlfs_take_snapshot get the incorrect results #5

Closed
GoogleCodeExporter opened this issue Jul 3, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
0. mkdir /tmp/testenv && mkdir /tmp/unittest
1. cd snapshot/build && cmake ../src && ./build_local.sh
2. cd ../src/snapshot/unittest/build/  &&  cmake ..
3. ./test
4. cd /tmp/testenv/testfs && cat snapshot.txt

[NOTE]This is in our snapshot branch, so you must download its all sources.

What is the expected output? What do you see instead?
expected output
================
+snapshot0#18446744071634696256#8240#
+ #18446744071634696300#16660#
++#18446744071634696345#25080#
+##@#18446744071634696380#33500#
+..#18446744071634696424#41920#
+ **#18446744071634696469#50340#
+1234#18446744071634696524#58760#

see instead
============
+snapshot#18446744071634696256#8240#
+#18446744071634696300#16660#
+#18446744071634696345#25080#
+###18446744071634696380#33500#
+.#18446744071634696424#41920#
+ *#18446744071634696469#50340#
+123#18446744071634696524#58760#


Please use labels and text to provide additional information.
Please see the snapshot branch for details.


Original issue reported on code.google.com by harryxi...@gmail.com on 28 Dec 2011 at 11:17

@GoogleCodeExporter
Copy link
Author

Index: src/snapshot/hlfs_take_snapshot.c
===================================================================
--- src/snapshot/hlfs_take_snapshot.c   (版本 255)
+++ src/snapshot/hlfs_take_snapshot.c   (版本 256)
@@ -11,6 +11,7 @@
 #include "snapshot.h"
 #include "storage_helper.h"
 #include "hlfs_log.h"
+#include "misc.h"

 int hlfs_take_snapshot(struct hlfs_ctrl *ctrl, const char *ssname)
 {
@@ -25,7 +26,7 @@
        return -1;
    }
    cp->timestamp = get_current_time();
-   g_strlcpy(cp->sname,ssname,strlen(ssname));
+   g_strlcpy(cp->sname,ssname,HLFS_FILE_NAME_MAX);
    cp->inode_addr = ctrl->imap_entry.inode_addr;
     g_mutex_lock (ctrl->hlfs_access_mutex);
    ret = dump_snapshot(ctrl->storage,SNAPSHOT_FILE,cp);

Original comment by harryxi...@gmail.com on 28 Dec 2011 at 12:04

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant