Hide Forgot
+++ This bug was initially created as a clone of Bug #1033795 +++ Description of problem: The "shellvars" lens for augeas fails to load an environment file that contains an "export" command with multiple variables on the same line. Version-Release number of selected component (if applicable): augeas-1.0.0-5 How reproducible: consistent Steps to Reproduce: 1. Create a file with multiple variables on a single export line: root@test:/u/test $ cat test_multi_export.shellvars #!/bin/sh TestVar1="test1" TestVar2="test2" export TestVar1 TestVar2 2. Then run "augtool --noautoload", load the file, and print the variables: root@test:/u/test $ augtool --noautoload augtool> set /augeas/load/test/lens "Shellvars.lns" augtool> set /augeas/load/test/incl /u/test/test_multi_export.shellvars augtool> load augtool> print /files/u/test/test_multi_export.shellvars augtool> Actual results: The variables TestVar1 and TestVar2 are not printed. Expected results: The variables TestVar1 and TestVar2 are printed. Additional info: Exporting the variables on their own separate "export" line works: root@test:/u/test $ cat test_single_export.shellvars #!/bin/sh TestVar1="test1" TestVar2="test2" export TestVar1 export TestVar2 Then run "augtool --noautoload", load the file, and print the variables: root@test:/u/test $ augtool --noautoload augtool> set /augeas/load/test/lens "Shellvars.lns" augtool> set /augeas/load/test/incl /u/test/test_single_export.shellvars augtool> load augtool> print /files/u/test/test_single_export.shellvars /files/u/test/test_single_export.shellvars /files/u/test/test_single_export.shellvars/#comment = "!/bin/sh" /files/u/test/test_single_export.shellvars/TestVar1 = "\"test1\"" /files/u/test/test_single_export.shellvars/TestVar2 = "\"test2\"" /files/u/test/test_single_export.shellvars/@export[1] = "TestVar1" /files/u/test/test_single_export.shellvars/@export[2] = "TestVar2" augtool> --- Additional comment from Andrew Sanders on 2013-11-22 23:19:36 GMT --- Diff of changes to shellvars.aug to handle multiple variables on the same export line. However, this may break backwards compatibility because it needs to handle the structure differently. --- Additional comment from Dominic Cleal on 2013-11-27 09:20:20 GMT --- We can include multiple exports within a single node to avoid breaking compatibility in 1.0.0, e.g. /files/u/test/test_single_export.shellvars/@export = "TestVar1 TestVar2" Retargeting to 6.6.0 as this is a 6.5 package.
For RHEL 7.0, I plan on changing the node layout to: { "@export" { "1" = "TestVar1" } { "2" = "TestVar2" } } Provided that https://github.com/hercules-team/augeas/pull/66 is accepted.
Can reproduce with augeas-1.1.0-4.el7, the same steps and results with 'Description' Steps to reproduce: 1. Create a script with multiple variables on a single export line: [host]#cat test.sh #!/bin/sh TestVar1="test1" TestVar2="test2" export TestVar1 TestVar2 2. Run "augtool --noautoload", load the file, and print the variables: [host]#augtool --noautoload augtool> set /augeas/load/test/lens "Shellvars.lns" augtool> set /augeas/load/test/incl /root/test.sh augtool> load augtool> print /files/root/test.sh augtool> Additional info: Exporting the variables on their own separate "export" line works: [host]#cat test.sh #!/bin/sh TestVar1="test1" TestVar2="test2" #export TestVar1 TestVar2 export TestVar1 export TestVar2 Run "augtool --noautoload", load the file, and print the variables: [host]#augtool --noautoload augtool> set /augeas/load/test/lens "Shellvars.lns" augtool> set /augeas/load/test/incl /root/test.sh augtool> load augtool> print /files/root/test.sh /files/root/test.sh /files/root/test.sh/#comment[1] = "!/bin/sh" /files/root/test.sh/TestVar1 = "\"test1\"" /files/root/test.sh/TestVar2 = "\"test2\"" /files/root/test.sh/#comment[2] = "export TestVar1 TestVar2" /files/root/test.sh/@export[1] = "TestVar1" /files/root/test.sh/@export[2] = "TestVar2" augtool>
Verified with augeas-1.1.0-6.el7 Steps to verified: 1. Create a script with multiple variables on a single export line: #cat test.sh #!/bin/sh TestVar1="test1" TestVar2="test2" export TestVar1 TestVar2 2. Run "augtool --noautoload", load the file, and print the variables: #augtool --noautoload augtool> set /augeas/load/test/lens "Shellvars.lns" augtool> set /augeas/load/test/incl /root/test.sh augtool> load augtool> print /files/root/test.sh /files/root/test.sh /files/root/test.sh/#comment = "!/bin/sh" /files/root/test.sh/TestVar1 = "\"test1\"" /files/root/test.sh/TestVar2 = "\"test2\"" /files/root/test.sh/@export /files/root/test.sh/@export/1 = "TestVar1" /files/root/test.sh/@export/2 = "TestVar2" Can export the two shellvars successfully, so bug is fixed.
This request was resolved in Red Hat Enterprise Linux 7.0. Contact your manager or support representative in case you have further questions about the request.