Akash-1221 opened a new pull request, #7167:
URL: https://github.com/apache/hbase/pull/7167

   Ticket : https://issues.apache.org/jira/browse/HBASE-28660
   
   # Description
   When using HBase Shell (tested on hbase 2.6.0), a bug exists related to 
failure handling. If a user accidentally uses an incorrect variable assignment 
with the same name as an HBase shell command (e.g., list_namespace or list), 
Ruby interprets it as a variable assignment, shadowing the command name.
   
   # Reproduce
   If want to review the bug open the HBase shell and execute the following 
command : 
   
   >hbase> list_namespace, 'ns.*'  
   >hbase> list_namespace   
   
   Returns Nil untill the shell is terminated or started again.
   
   # Root Cause
   The main root cause behind the bug is that, shell allows the user to define 
variables with the same name as of command.
   Like it allow a user to create a variable like list = 10 or list_namespace = 
'some value' resulting in shadowing the command.
   So whenever, a user enters something inside the hbase shell like below it 
creates a variable : 
   > list = 10
   > list,list_namespace = 20, 30 
   > list_namespace, 'ns.*'
   
   Whenever a user enters **list_namespace, 'ns.*'** in hbase shell then it 
creates a local variable list_namespace with value nil. And can be varified by 
checking the local variable by running the following command in HBase shell : 
   > local_variables
   
   Adding the below image for reference : 
   
   <img width="671" height="384" alt="Screenshot from 2025-07-22 16-39-16" 
src="https://github.com/user-attachments/assets/7fe7d1c6-01c9-4d01-bbc6-7a7207b584d2";
 />
   
   
   # Fix for the Bug
   Modified the **hirb.rb**  file inside the irb directory, by adding a 
function i.e **check_variable_assignment_conflict** which allows to create a 
variable if an only if its name different from the HBase shell command name. If 
the variable name matches with the command, then it gives the error like can't 
create the variable with command name and skips the iteration.
   
   # Working after the fix 
   Executing the same above commands in hbase shell to review the fix : 
   
   <img width="685" height="393" alt="Screenshot from 2025-07-22 16-32-57" 
src="https://github.com/user-attachments/assets/1dc8519f-fc26-4114-9af5-2e14308d271f";
 />
   
   # NOTE 
   -  Fix doesn't allows a user to create variable with command name during 
single, multiple and multiline variable assignment.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to