+++ This bug was initially created as a clone of Bug #1574606 +++ Description of problem: The following regression test fails everytime with the the below error. TEST: tests/bugs/posix/bug-990028.t ERROR: ok 163, LINENUM:78 tests/bugs/posix/../../include.rc: line 334: [: too many arguments not ok 164 , LINENUM:82 FAILED COMMAND: [ 0x00000001 0x00000001 = 0x00000001 ] not ok 165 , LINENUM:82 FAILED COMMAND: [ 0x00000001 0x00000001 = 0x00000001 ] tests/bugs/posix/../../include.rc: line 334: [: too many arguments ok 166, LINENUM:88 ok 167, LINENUM:91 ok 168, LINENUM:95 ok 169, LINENUM:99 ok 170, LINENUM:105 ok 171, LINENUM:108 ok 172, LINENUM:113 ok 173, LINENUM:116 ok 174, LINENUM:117 ok 175, LINENUM:123 ok 176, LINENUM:126 ok 177, LINENUM:128 ok 178, LINENUM:135 ok 179, LINENUM:135 ok 180, LINENUM:141 ok 181, LINENUM:146 ok 182, LINENUM:146 ok 183, LINENUM:149 ok 184, LINENUM:155 Failed 2/184 subtests Test Summary Report ------------------- tests/bugs/posix/bug-990028.t (Wstat: 0 Tests: 184 Failed: 2) Failed tests: 164-165 The failure happens because in the line 82 the getfattr command to get the value of the xattr trusted.pgfid.<gfid> each line fails and it still prints the output of 2 lines (i.e. both the xattrs, instead of the xattr that correspond to the file in interest) getfattr -m "trusted.pgfid.*" -de hex /d/backends/brick/dir2/file2 2>&1 | grep "trusted.pgfid" | cut -d$'\n' -f 1 | cut -d'=' -f2 0x00000001 0x00000001 [root@hp-dl380pgen8-02-vm-10 gluster-gerrit]# getfattr -m "trusted.pgfid.*" -de hex /d/backends/brick/dir2/file2 2>&1 | grep "trusted.pgfid" | cut -d$'\n' -f 1 trusted.pgfid.1373485a-2780-4101-96ba-e5f4a63005cd=0x00000001 trusted.pgfid.e7180d50-89f4-4624-b4e3-408327fa695b=0x00000001 After some investigation found the below FIX: The following for loop (which makes use of "awk -v n=$i 'NR==n'" will print only one line at a time (1st line for 1st iteration of the for loop and 2nd line for the 2nd iteration of the for loop) for i in $(seq 1 2) ; do getfattr -m "trusted.pgfid.*" -de hex /d/backends/brick/dir$i/file$i 2>&1 | grep "trusted.pgfid" | awk -v n=$i 'NR==n'; done trusted.pgfid.1373485a-2780-4101-96ba-e5f4a63005cd=0x00000001 trusted.pgfid.e7180d50-89f4-4624-b4e3-408327fa695b=0x00000001 With the above change all the tests passed from this test case. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: --- Additional comment from Worker Ant on 2018-05-03 12:21:51 EDT --- REVIEW: https://review.gluster.org/19959 (use awk to get a specific line from the output instead of cut) posted (#1) for review on master by Raghavendra Bhat --- Additional comment from Worker Ant on 2018-05-04 00:53:00 EDT --- COMMIT: https://review.gluster.org/19959 committed in master by "Amar Tumballi" <amarts> with a commit message- use awk to get a specific line from the output instead of cut cut -d$'\n' is not separating the xattrs shown as part of getfattr output. Hence use awk to get the nth line of getfattr output for nth iteration in the for loop. Change-Id: I1a96cd3f72f4f407f9a783375f78d9a69d5d3885 fixes: bz#1574606 Signed-off-by: Raghavendra Bhat <raghavendra>
Oops. Mistake. The bug is part of gluster-4.1 branch. So closing this bug.