[LU-6205] tests: fix bash expansion of FIDs Created: 03/Feb/15  Updated: 24/Apr/17  Resolved: 24/Mar/15

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.7.0
Fix Version/s: Lustre 2.8.0

Type: Bug Priority: Minor
Reporter: Frank Zago (Inactive) Assignee: WC Triage
Resolution: Fixed Votes: 0
Labels: patch

Issue Links:
Related
Severity: 3
Rank (Obsolete): 17351

 Description   

When calling lfs path2fid, and FID is returned between bracket. When that fid variable is used, it is then expanded by the shell to something else. For instance when it is given to fid2path, it returns an error:

$ ../utils/lfs fid2path lustre [0x200000be7:0xb:0x0]
bad FID format [x], should be [0x1:0x2:0x0]

fid2path: error on FID x: Invalid argument

This will cause some tests, such as 154A or test_238 to fail under certain conditions, such as being called with:

ONLY=154A PDSH=ssh AGTCOUNT=1 agt1_HOST=localhost \
NAME=local sh ./sanity.sh



 Comments   
Comment by Gerrit Updater [ 03/Feb/15 ]

frank zago (fzago@cray.com) uploaded a new patch: http://review.whamcloud.com/13618
Subject: LU-6205 tests: fix bash expansion of fid
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: aa99d73b66d377c0d5bad798eafbb25b0413b524

Comment by Robert Read (Inactive) [ 03/Feb/15 ]

I can't figure out how to make this fail. Do you have a simple reproducer for this?

[root@test1 lustre]# touch foo
[root@test1 lustre]# lfs path2fid foo
[0x200000400:0x4a:0x0]
[root@test1 lustre]# lfs fid2path lustre [0x200000400:0x4a:0x0]
foo
[root@test1 lustre]# v=[0x200000400:0x4a:0x0]
[root@test1 lustre]# lfs fid2path lustre $v
foo
Comment by Frank Zago (Inactive) [ 03/Feb/15 ]

Your sample fails for me:

# lustre/utils/lfs fid2path lustre [0x200000400:0x4a:0x0]
bad FID format [a], should be [0x1:0x2:0x0]

# v=[0x200000400:0x4a:0x0]
[root@c65-l251-intel-fzago lustre-cleanup]# lustre/utils/lfs fid2path lustre $v
bad FID format [a], should be [0x1:0x2:0x0]

I'm running bash on centos 6.5.

Comment by Frank Zago (Inactive) [ 03/Feb/15 ]

Robert, create a file "a" and try again.

# v=[0x200000400:0x4a:0x0]
# lfs fid2path lustre $v
fid2path: error on FID [0x200000400:0x4a:0x0]: No such file or directory
# touch a
# lfs fid2path lustre $v
bad FID format [a], should be [0x1:0x2:0x0]

fid2path: error on FID a: Invalid argument
Comment by Robert Read (Inactive) [ 04/Feb/15 ]

doh!

Comment by Gerrit Updater [ 18/Mar/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/13618/
Subject: LU-6205 tests: fix bash expansion of fid
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: fd3bfcd73ee93e356adb716b11feca4bfd860af4

Comment by James Nunez (Inactive) [ 24/Mar/15 ]

Landed to master (pre-2.8.0)

Comment by Li Xi (Inactive) [ 16/Jan/16 ]

There are other scripts that needs similar fix, e.g.

== sanity-lfsck test 2a: LFSCK can find out and repair crashed linkEA entry == 02:11:11 (1452877871)
formatall
setupall
preparing... 1 * 1 files will be created.
prepared.
stop mds1
start mds1
Starting client: atest-vm31: -o user_xattr,flock atest-vm32@tcp:/lustre /mnt/lustre
fail_loc=0x1603
fail_loc=0
10.128.12.32@tcp:/lustre /mnt/lustre lustre rw,flock,user_xattr 0 0
Stopping client atest-vm31 /mnt/lustre (opts
Started LFSCK on the device lustre-MDT0000: namespace.
Starting client: atest-vm31: -o user_xattr,flock atest-vm32@tcp:/lustre /mnt/lustre
bad FID format [b], should be [0x1:0x2:0x0]

fid2path: error on FID b: Invalid argument
sanity-lfsck test_2a: @@@@@@ FAIL: (8) Fail to repair linkEA: [0x280000bd0:0x1:0x0]
Trace dump:
= /usr/lib64/lustre/tests/test-framework.sh:4421:error_noexit()
= /usr/lib64/lustre/tests/test-framework.sh:4452:error()
= /usr/lib64/lustre/tests/sanity-lfsck.sh:262:test_2a()
= /usr/lib64/lustre/tests/test-framework.sh:4691:run_one()
= /usr/lib64/lustre/tests/test-framework.sh:4728:run_one_logged()
= /usr/lib64/lustre/tests/test-framework.sh:4594:run_test()
= /usr/lib64/lustre/tests/sanity-lfsck.sh:264:main()
Dumping lctl log to /tmp/test_logs/logdir_1007_sanity-lfsck_1/sanity-lfsck.test_2a.*.1452877964.log

Generated at Sat Feb 10 01:58:10 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.