You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Akhilesh Naidu <ak...@persistent.com> on 2017/01/24 14:01:53 UTC

[DISCUSS]- JIRA ISSUE KAFKA-4566 : Can't Symlink to Kafka bins

Hi,


The bug deals with the problem one encounters in case if the script 'kafka-console-consumer.sh' is executed
through a symlink which could be placed on a different location on disk

The initial suggestion provided in the bug was to make changes in the below line
exec $(dirname $0)/kafka-run-class.sh kafka.tools.ConsoleConsumer "$@"

to replace it to
"$(dirname "$(readlink -e "$0")")"

But as commented in the bug earlier,
the above would be OS dependent as MacOS version of readlink does not have an -e option.

1) One approach could be to simulate the working of the readlink function, in a portable manner. I have a working patch for this.
The details are available in the comment link
https://issues.apache.org/jira/browse/KAFKA-4566?focusedCommentId=15831442&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15831442


2) Now seeing that the other scripts in the 'kafka/bin/' location also could have similar calls from symlink
I tried moving the function snippet into a separate utilities file, in order to reuse,
but if we intend to include the utilities file in all the scripts we need to have the exact base location to our utilities file,
which is what we wrote our function in the first place for [☹] .
So the only option seems to duplicate the function code in all required scripts.

Any suggestions on how to go about the above.





Regards

Akhilesh




DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.


Re: [DISCUSS]- JIRA ISSUE KAFKA-4566 : Can't Symlink to Kafka bins

Posted by Colin McCabe <cm...@apache.org>.
Thanks for the background.  This is a tough one, because all the
proposed solutions are very long, and we would have to put them in each
script file.  I think it's probably not worth it, since people can write
their own wrappers that suit their needs.  But I haven't thought about
it that much-- maybe there is a good solution out there.

best,
Colin


On Thu, Jan 26, 2017, at 22:37, Akhilesh Naidu wrote:
> Hi Colin,
> 
> 
> I had picked up this bug from when it was reported specifically for the
> script 'kafka-console-consumer.sh'.
> 
> Going through the bug description it seemed the reporter wanted to call
> the scripts form maybe another
> 
> location using symlinks. Hence the extra code to replicate the readlink
> behavior.
> 
> 
> Going ahead we thought that this could also end up being a generic case
> for all the other scripts in the bin file
> 
> and hence the confusion about having the same code duplicated in all the
> other files in bin directory.
> 
> 
> 
> 
> Regards
> 
> Akhilesh
> 
> 
> 
> 
> ________________________________
> From: Colin McCabe <cm...@apache.org>
> Sent: Thursday, January 26, 2017 12:55:16 AM
> To: dev@kafka.apache.org
> Subject: Re: [DISCUSS]- JIRA ISSUE KAFKA-4566 : Can't Symlink to Kafka
> bins
> 
> Thanks for looking at this, Akhilesh.  Can you be a little bit clearer
> about why keeping all the scripts or script symlinks in the same
> directory is not an option for you?
> 
> 
> best,
> 
> Colin
> 
> 
> 
> On Tue, Jan 24, 2017, at 06:01, Akhilesh Naidu wrote:
> 
> > Hi,
> 
> 
> 
> >
> 
> 
> 
> >
> 
> 
> 
> > The bug deals with the problem one encounters in case if the script
> > 'kafka-console-consumer.sh' is executed
> >  through a symlink which could be placed on a different location
> >  on disk
> >
> 
> >  The initial suggestion provided in the bug was to make changes in the
> >  below line
> >  exec $(dirname $0)/kafka-run-class.sh
> >  kafka.tools.ConsoleConsumer "$@"
> >
> 
> >  to replace it to
> 
> >  "$(dirname "$(readlink -e "$0")")"
> 
> >
> 
> >  But as commented in the bug earlier,
> 
> >  the above would be OS dependent as MacOS version of readlink does not
> >  have an -e option.
> >
> 
> >  1) One approach could be to simulate the working of the readlink
> >     function, in a portable manner. I have a working patch for this.
> >  The details are available in the comment link
> 
> >  https://issues.apache.org/jira/browse/KAFKA-4566?focusedCommentId=15831442&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15831442
> >
> 
> >
> 
> >  2) Now seeing that the other scripts in the 'kafka/bin/' location
> >     also could have similar calls from symlink
> >  I tried moving the function snippet into a separate utilities file,
> >  in order to reuse,
> >  but if we intend to include the utilities file in all the scripts we
> >  need to have the exact base location to our utilities file,
> >  which is what we wrote our function in the first place for :(.
> 
> >  So the only option seems to duplicate the function code in all
> >  required scripts.
> >
> 
> >  Any suggestions on how to go about the above.
> 
> >
> 
> >
> 
> 
> 
> >
> 
> 
> 
> >
> 
> 
> 
> > Regards
> 
> 
> 
> > Akhilesh
> 
> 
> 
> >
> 
> 
> 
> >
> 
> 
> 
> > DISCLAIMER ========== This e-mail may contain privileged and
> > confidential information which is the property of Persistent Systems
> > Ltd. It is intended only for the use of the individual or entity to
> > which it is addressed. If you are not the intended recipient, you are
> > not authorized to read, retain, copy, print, distribute or use this
> > message. If you have received this communication in error, please
> > notify the sender and delete all copies of this message. Persistent
> > Systems Ltd. does not accept any liability for virus infected mails.
> 
> 
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Ltd. It is intended only for the use
> of the individual or entity to which it is addressed. If you are not the
> intended recipient, you are not authorized to read, retain, copy, print,
> distribute or use this message. If you have received this communication
> in error, please notify the sender and delete all copies of this message.
> Persistent Systems Ltd. does not accept any liability for virus infected
> mails.
> 

Re: [DISCUSS]- JIRA ISSUE KAFKA-4566 : Can't Symlink to Kafka bins

Posted by Akhilesh Naidu <ak...@persistent.com>.
Hi Colin,


I had picked up this bug from when it was reported specifically for the script 'kafka-console-consumer.sh'.

Going through the bug description it seemed the reporter wanted to call the scripts form maybe another

location using symlinks. Hence the extra code to replicate the readlink behavior.


Going ahead we thought that this could also end up being a generic case for all the other scripts in the bin file

and hence the confusion about having the same code duplicated in all the other files in bin directory.




Regards

Akhilesh




________________________________
From: Colin McCabe <cm...@apache.org>
Sent: Thursday, January 26, 2017 12:55:16 AM
To: dev@kafka.apache.org
Subject: Re: [DISCUSS]- JIRA ISSUE KAFKA-4566 : Can't Symlink to Kafka bins

Thanks for looking at this, Akhilesh.  Can you be a little bit clearer
about why keeping all the scripts or script symlinks in the same
directory is not an option for you?


best,

Colin



On Tue, Jan 24, 2017, at 06:01, Akhilesh Naidu wrote:

> Hi,



>



>



> The bug deals with the problem one encounters in case if the script
> 'kafka-console-consumer.sh' is executed
>  through a symlink which could be placed on a different location
>  on disk
>

>  The initial suggestion provided in the bug was to make changes in the
>  below line
>  exec $(dirname $0)/kafka-run-class.sh
>  kafka.tools.ConsoleConsumer "$@"
>

>  to replace it to

>  "$(dirname "$(readlink -e "$0")")"

>

>  But as commented in the bug earlier,

>  the above would be OS dependent as MacOS version of readlink does not
>  have an -e option.
>

>  1) One approach could be to simulate the working of the readlink
>     function, in a portable manner. I have a working patch for this.
>  The details are available in the comment link

>  https://issues.apache.org/jira/browse/KAFKA-4566?focusedCommentId=15831442&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15831442
>

>

>  2) Now seeing that the other scripts in the 'kafka/bin/' location
>     also could have similar calls from symlink
>  I tried moving the function snippet into a separate utilities file,
>  in order to reuse,
>  but if we intend to include the utilities file in all the scripts we
>  need to have the exact base location to our utilities file,
>  which is what we wrote our function in the first place for :(.

>  So the only option seems to duplicate the function code in all
>  required scripts.
>

>  Any suggestions on how to go about the above.

>

>



>



>



> Regards



> Akhilesh



>



>



> DISCLAIMER ========== This e-mail may contain privileged and
> confidential information which is the property of Persistent Systems
> Ltd. It is intended only for the use of the individual or entity to
> which it is addressed. If you are not the intended recipient, you are
> not authorized to read, retain, copy, print, distribute or use this
> message. If you have received this communication in error, please
> notify the sender and delete all copies of this message. Persistent
> Systems Ltd. does not accept any liability for virus infected mails.


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.


Re: [DISCUSS]- JIRA ISSUE KAFKA-4566 : Can't Symlink to Kafka bins

Posted by Colin McCabe <cm...@apache.org>.
Thanks for looking at this, Akhilesh.  Can you be a little bit clearer
about why keeping all the scripts or script symlinks in the same
directory is not an option for you?


best,

Colin



On Tue, Jan 24, 2017, at 06:01, Akhilesh Naidu wrote:

> Hi,



> 



> 



> The bug deals with the problem one encounters in case if the script
> 'kafka-console-consumer.sh' is executed
>  through a symlink which could be placed on a different location
>  on disk
> 

>  The initial suggestion provided in the bug was to make changes in the
>  below line
>  exec $(dirname $0)/kafka-run-class.sh
>  kafka.tools.ConsoleConsumer "$@"
> 

>  to replace it to 

>  "$(dirname "$(readlink -e "$0")")"

> 

>  But as commented in the bug earlier, 

>  the above would be OS dependent as MacOS version of readlink does not
>  have an -e option.
> 

>  1) One approach could be to simulate the working of the readlink
>     function, in a portable manner. I have a working patch for this.
>  The details are available in the comment link

>  https://issues.apache.org/jira/browse/KAFKA-4566?focusedCommentId=15831442&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15831442
> 

> 

>  2) Now seeing that the other scripts in the 'kafka/bin/' location
>     also could have similar calls from symlink
>  I tried moving the function snippet into a separate utilities file,
>  in order to reuse,
>  but if we intend to include the utilities file in all the scripts we
>  need to have the exact base location to our utilities file,
>  which is what we wrote our function in the first place for ☹.

>  So the only option seems to duplicate the function code in all
>  required scripts.
> 

>  Any suggestions on how to go about the above.

> 

> 



> 



>  



> Regards



> Akhilesh



> 



>  



> DISCLAIMER ========== This e-mail may contain privileged and
> confidential information which is the property of Persistent Systems
> Ltd. It is intended only for the use of the individual or entity to
> which it is addressed. If you are not the intended recipient, you are
> not authorized to read, retain, copy, print, distribute or use this
> message. If you have received this communication in error, please
> notify the sender and delete all copies of this message. Persistent
> Systems Ltd. does not accept any liability for virus infected mails.