Bug 1599783

Summary: _is_prefix should return false for 0-length strings
Product: [Community] GlusterFS Reporter: Kaushal <kaushal>
Component: glusterdAssignee: Kaushal <kaushal>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-5.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1599785 1599788 (view as bug list) Environment:
Last Closed: 2018-10-23 15:13:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1484412, 1599785, 1599788, 1599803, 1599823    

Description Kaushal 2018-07-10 15:15:06 UTC
The `_is_prefix` function in glusterd-utils.c is used to check if one of 2 given paths contains the other. When one of the passed paths is a 0-length string, `_is_prefix` returns true. This is incorrect, as a 0-length string is not a path, and isn't a prefix of the other.

The current behaviour sometimes causes problems when creating new volumes, as it causes new brick paths to appear to contain/be contained by old bricks.
Because of issues with volume deletion and volume sync, there are cases when stale volumes with stale and incomplete brickinfo could be present.

Comment 1 Worker Ant 2018-07-10 15:37:03 UTC
REVIEW: https://review.gluster.org/20490 (glusterd: _is_prefix should handle 0-length paths) posted (#1) for review on master by Kaushal M

Comment 2 Worker Ant 2018-07-11 12:00:31 UTC
COMMIT: https://review.gluster.org/20490 committed in master by "Kaushal M" <kaushal> with a commit message- glusterd: _is_prefix should handle 0-length paths

If one of the paths given to _is_prefix is 0-length, then it is not a
prefix of the other. Hence, _is_prefix should return false.

Change-Id: I54aa577a64a58940ec91872d0d74dc19cff9106d
fixes: bz#1599783
Signed-off-by: Kaushal M <kaushal>

Comment 3 Shyamsundar 2018-10-23 15:13:48 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-5.0, please open a new bug report.

glusterfs-5.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] https://lists.gluster.org/pipermail/announce/2018-October/000115.html
[2] https://www.gluster.org/pipermail/gluster-users/