You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/07/19 05:38:19 UTC

[GitHub] [incubator-apisix] totemofwolf opened a new pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

totemofwolf opened a new pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867


   
   
   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] totemofwolf commented on a change in pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

Posted by GitBox <gi...@apache.org>.
totemofwolf commented on a change in pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867#discussion_r456922256



##########
File path: bin/apisix
##########
@@ -52,7 +52,7 @@ if script_path:sub(1, 2) == './' then
         error("failed to fetch current path")
     end
 
-    if string.match(apisix_home, '^/[root][^/]+') then
+    if string.match(apisix_home .. "/", '^[/root]*/$') then

Review comment:
       > @totemofwolf what is your current home path?
   > 
   > we can print variable `apisix_home`. I can not understand why you got the warning message.
   
   
   ```
   
   ➜  /root1 pwd
   /root1
   
   
       -- if string.match(apisix_home .. "/", '^[/root]*/$') then
       if string.match(apisix_home, '^/[root][^/]+') then
               is_root_path = true
       end
   ...
   end
   print("apisix_home: ", apisix_home)
   
   ➜  /root1 make init
   ./bin/apisix init
   apisix_home: 	/root1
   Warning! Running apisix under /root is only suitable for development environments and it is dangerous to do so. It is recommended to run APISIX in a directory other than /root. 
   ./bin/apisix init_etcd
   apisix_home: 	/root1
   
   ```
   
   ----
   
   
   `if string.match(apisix_home .. "/", '^[/root]*/$') then` works both for `/root1`(no warning) and `/root` (with warning) which is the correct logic ;-)
   
   ```
   
   ➜  /root1 pwd
   /root1
   
       if string.match(apisix_home .. "/", '^[/root]*/$') then
       -- if string.match(apisix_home, '^/[root][^/]+') then
               is_root_path = true
       end
   
   ...
   end
   print("apisix_home: ", apisix_home)
   
   ➜  /root1 make init
   ./bin/apisix init
   apisix_home: 	/root1
   ./bin/apisix init_etcd
   apisix_home: 	/root1
   
   ```




----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] membphis commented on a change in pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867#discussion_r456926258



##########
File path: bin/apisix
##########
@@ -52,7 +52,7 @@ if script_path:sub(1, 2) == './' then
         error("failed to fetch current path")
     end
 
-    if string.match(apisix_home, '^/[root][^/]+') then
+    if string.match(apisix_home .. "/", '^[/root]*/$') then

Review comment:
       Wow, your example is very special




----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] membphis commented on a change in pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867#discussion_r460656236



##########
File path: bin/apisix
##########
@@ -52,7 +52,7 @@ if script_path:sub(1, 2) == './' then
         error("failed to fetch current path")
     end
 
-    if string.match(apisix_home, '^/[root][^/]+') then
+    if string.match(apisix_home .. "/", '^[/root]*/$') then

Review comment:
       I think only `'^/root/'` is right, it means the prefix should be `/root/`.
   
   `^[/root]*/$` is wrong, here is an example:
   
   ```shell
   $ resty -e 'ngx.say(string.match("/roo/", "^[/root]*/$"))'
   /roo/
   ```
   




----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] membphis commented on pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867#issuecomment-660645773


   @totemofwolf what is your current home path?
   
   we can print variable `apisix_home`. I can not understand why you got the warning message.


----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] membphis commented on a change in pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867#discussion_r456910921



##########
File path: bin/apisix
##########
@@ -52,7 +52,7 @@ if script_path:sub(1, 2) == './' then
         error("failed to fetch current path")
     end
 
-    if string.match(apisix_home, '^/[root][^/]+') then
+    if string.match(apisix_home .. "/", '^[/root]*/$') then

Review comment:
        I do not why the new regex can work correctly :(




----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] totemofwolf commented on a change in pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

Posted by GitBox <gi...@apache.org>.
totemofwolf commented on a change in pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867#discussion_r460537412



##########
File path: bin/apisix
##########
@@ -52,7 +52,7 @@ if script_path:sub(1, 2) == './' then
         error("failed to fetch current path")
     end
 
-    if string.match(apisix_home, '^/[root][^/]+') then
+    if string.match(apisix_home .. "/", '^[/root]*/$') then

Review comment:
       > `if string.match(apisix_home .. "/", '^/root/') then`
   > 
   > You can make a try in this way, this way is better.
   
   
   ```
       if string.match(apisix_home .. "/", '^[/root]*/$') then
       -- if string.match(apisix_home, '^/[root][^/]+') then
       if string.match(apisix_home .. "/", '^/root/') then
               is_root_path = true
       end
   ```
   
   It works except ` if string.match(apisix_home, '^/[root][^/]+') then`
   
   




----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] membphis commented on pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867#issuecomment-664091485


   @totemofwolf I think we can close this PR and push a new PR. I don't have the ability to review this PR, it is too big.
   
   ![image](https://user-images.githubusercontent.com/6814606/88498932-12f2df80-cff7-11ea-948e-27731270557b.png)
   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] membphis commented on a change in pull request #1867: change: fix wrong info `Warning! Running apisix under /root ...`when `make init` at non-root path

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1867:
URL: https://github.com/apache/incubator-apisix/pull/1867#discussion_r456926438



##########
File path: bin/apisix
##########
@@ -52,7 +52,7 @@ if script_path:sub(1, 2) == './' then
         error("failed to fetch current path")
     end
 
-    if string.match(apisix_home, '^/[root][^/]+') then
+    if string.match(apisix_home .. "/", '^[/root]*/$') then

Review comment:
       `if string.match(apisix_home .. "/", '^/root/') then` 
   
   You can make a try in this way, this way is better.
   




----------------------------------------------------------------
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.

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