Interested in contributing to Bash

2017-05-21 Thread Pranav Deshpande
Hello everyone,
I am a beginner when it comes to open source and am interested in
contributing to GNU Bash.

Any guidance on so as how to get started? Are there any tasks that I can
take up so that I get introduced to the code base.

Regards,
Pranav.


History Feature issue

2017-05-21 Thread Pranav Deshpande
The lssue here: https://savannah.gnu.org/support/?109000 interests me.
It's something that I have experienced while using the shell. I am
interested in solving it

Any ideas so as how can I get started with the code base?

Regards,
Pranav


Re: History Feature issue

2017-05-22 Thread Pranav Deshpande
Thank you.
It seems that there is no read to implement this feature. Could you suggest
me some bug so that I can get started?
Something which is simple for a beginner?

Regards,
Pranav.

On Mon, May 22, 2017 at 3:06 AM, Eduardo Bustamante 
wrote:

> On Sun, May 21, 2017 at 11:29 AM, Pranav Deshpande
>  wrote:
> > The lssue here: https://savannah.gnu.org/support/?109000 interests me.
> > It's something that I have experienced while using the shell. I am
> > interested in solving it
>
> That bug report lacks detail. There are already ways of sharing
> history between multiple sessions. Some of the alternatives are
> outlined here: https://unix.stackexchange.com/questions/1288/preserve-
> bash-history-in-multiple-terminal-windows
>
> Give these a try first.
>
> > Any ideas so as how can I get started with the code base?
>
> If you're interested in the implementation, review:
>
> dualbus@debian:~/src/gnu/bash$ head -n1 bashhist.c builtins/history.def
> ==> bashhist.c <==
> /* bashhist.c -- bash interface to the GNU history library. */
>
> ==> builtins/history.def <==
> This file is history.def, from which is created history.c.
>
> And if you want to go into even more detail, review the history
> library as implemented by GNU readline (and bundled with bash):
>
> dualbus@debian:~/src/gnu/bash$ head -n1 lib/readline/hist*c
> ==> lib/readline/histexpand.c <==
> /* histexpand.c -- history expansion. */
>
> ==> lib/readline/histfile.c <==
> /* histfile.c - functions to manipulate the history file. */
>
> ==> lib/readline/history.c <==
> /* history.c -- standalone history library */
>
> ==> lib/readline/histsearch.c <==
> /* histsearch.c -- searching the history list. */
>


Re: History Feature issue

2017-05-22 Thread Pranav Deshpande
I am still just looking at the source codeTrying to figure out how it
works.

Regards,
Pranav

On Mon, May 22, 2017 at 4:30 PM, Pierre Gaston 
wrote:

> I'd suggest that you look into the loadable builtin examples in the
> tarball and find ideas to write a couple of these.
>
> For instance, you could try to write a Json parser that allows callback
> and set some bash variables mirroring the Json in an associative array or
> something like that.
>
> There is little documentation so as a result you kind have to look around
> in bash source code, and cool builtins could be a way to contribute to bash.
>
> At least that's what I do ( https://github.com/pgas ), even though I have
> no real ambition doing this :D
>
> Pierre
>
> On Mon, May 22, 2017 at 1:27 PM, Pranav Deshpande <
> deshpande.v.pra...@gmail.com> wrote:
>
>> Thank you.
>> It seems that there is no read to implement this feature. Could you
>> suggest
>> me some bug so that I can get started?
>> Something which is simple for a beginner?
>>
>> Regards,
>> Pranav.
>>
>> On Mon, May 22, 2017 at 3:06 AM, Eduardo Bustamante 
>> wrote:
>>
>> > On Sun, May 21, 2017 at 11:29 AM, Pranav Deshpande
>> >  wrote:
>> > > The lssue here: https://savannah.gnu.org/support/?109000 interests
>> me.
>> > > It's something that I have experienced while using the shell. I am
>> > > interested in solving it
>> >
>> > That bug report lacks detail. There are already ways of sharing
>> > history between multiple sessions. Some of the alternatives are
>> > outlined here: https://unix.stackexchange.com/questions/1288/preserve-
>> > bash-history-in-multiple-terminal-windows
>> >
>> > Give these a try first.
>> >
>> > > Any ideas so as how can I get started with the code base?
>> >
>> > If you're interested in the implementation, review:
>> >
>> > dualbus@debian:~/src/gnu/bash$ head -n1 bashhist.c builtins/history.def
>> > ==> bashhist.c <==
>> > /* bashhist.c -- bash interface to the GNU history library. */
>> >
>> > ==> builtins/history.def <==
>> > This file is history.def, from which is created history.c.
>> >
>> > And if you want to go into even more detail, review the history
>> > library as implemented by GNU readline (and bundled with bash):
>> >
>> > dualbus@debian:~/src/gnu/bash$ head -n1 lib/readline/hist*c
>> > ==> lib/readline/histexpand.c <==
>> > /* histexpand.c -- history expansion. */
>> >
>> > ==> lib/readline/histfile.c <==
>> > /* histfile.c - functions to manipulate the history file. */
>> >
>> > ==> lib/readline/history.c <==
>> > /* history.c -- standalone history library */
>> >
>> > ==> lib/readline/histsearch.c <==
>> > /* histsearch.c -- searching the history list. */
>> >
>>
>
>


Re: Interested in contributing to Bash

2017-05-23 Thread Pranav Deshpande
Thank you!
I will be reading it now. What do you think of the 'bugs' Eduardo mentioned?

Regards,
Pranav.

On Wed, May 24, 2017 at 12:09 AM, Chet Ramey  wrote:

> On 5/21/17 11:53 AM, Eduardo Bustamante wrote:
> > On Sun, May 21, 2017 at 5:44 AM, Pranav Deshpande
> >  wrote:
> > [...]
> >> Any guidance on so as how to get started? Are there any tasks that I can
> >> take up so that I get introduced to the code base.
> >
> > My recommendations would be:
> >
> > - Clone the git repository (https://savannah.gnu.org/git/?group=bash)
> > - Subscribe both bug-bash@gnu.org and help-b...@gnu.org. Try to
> > reproduce bug reports and report back the results.
> > - Read the mailing list archives
> > (https://lists.gnu.org/archive/html/bug-bash/ and
> > https://lists.gnu.org/archive/html/help-bash/), and take note of any
> > reported bugs that are not answered or fixed yet in the latest `devel'
> > branch of the git repository.
> > - Some people place bug reports in the Savannah issue tracker
> > (https://savannah.gnu.org/support/?group=bash). You might also want to
> > check there and see if any of the issues reported there are still not
> > fixed in the latest `devel' branch.
>
> The best thing to read to learn about how the shell is structured -- other
> than the code itself -- is the unedited version of the chapter I wrote for
> AOSA (The Architecture of Open Source Applications).  It's in the bash-4.4
> distribution in doc/aosa-bash-full.pdf.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~
> chet/
>


Re: Builtin history -r does not work with named pipes (i.e. GNU readline's histfile.c read_history_range)

2017-05-29 Thread Pranav Deshpande
So I can't take up this one?

Regards,
Pranav

On May 30, 2017 2:35 AM, "Chet Ramey"  wrote:

> On 5/29/17 4:40 PM, dualbus wrote:
> > On Mon, May 29, 2017 at 04:17:16PM -0400, Chet Ramey wrote:
> > [...]
> >> So the bug is that readline doesn't print an error message if the
> history
> >> file isn't a regular file?
> >
> > Correct. Another problem is that the history builtin doesn't propagate
> > back a meaningful return code indicating that there was a problem.
>
> OK, that's an easy fix. It wasn't clear whether this was the problem, or
> whether the original poster was complaining that the lack of support for
> non-regular files was the bug. Thanks.
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~
> chet/
>


Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-05-31 Thread Pranav Deshpande
Thank you. I am travelling now and will look at it in 2 days.

Regards,
Pranav

On May 31, 2017 7:48 PM, "Chet Ramey"  wrote:

> On 5/23/17 11:33 AM, Eduardo Bustamante wrote:
> > (I think this is a good problem for Pranav to tackle if you consider
> > this to be a bug, Chet).
>
> Thanks. Another one that he can look at and see how his solution compares
> to mine.
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~
> chet/
>


Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-06-03 Thread Pranav Deshpande
Hello,
Sorry for the late reply.

My solution is to change *line 294* of builtins/read.def.

Change
if (code == 0 || *intval < 0* || intval != (int)intval)

to

if (code == 0 || i*ntval <= 0* || intval != (int)intval)

Command:

./bash -c 'read -n0 <<< "abc";declare -p REPLY'

Output:
./bash: line 0: read: 0: invalid number
./bash: line 0: declare: REPLY: not found

i.e. behaviour #1.

Is this solution ok?

Regards,
Pranav


Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-06-03 Thread Pranav Deshpande
Is that more advantageous?

On Sun, Jun 4, 2017 at 10:46 AM, dualbus  wrote:

> On Sun, Jun 04, 2017 at 01:45:42AM +0530, Pranav Deshpande wrote:
> [...]
> > My solution is to change *line 294* of builtins/read.def.
> >
> > Change
> > if (code == 0 || *intval < 0* || intval != (int)intval)
> >
> > to
> >
> > if (code == 0 || i*ntval <= 0* || intval != (int)intval)
> [...]
>
> > Is this solution ok?
>
> Yes. That works.
>
>
> Chet went with the other option though:
>
>   dualbus@debian:~/src/gnu/bash-build$ ./bash -c 'read -n0; echo $?;
> declare -p REPLY'
>   0
>   declare -- REPLY=""
>
> You can see the change by navigating the `devel' branch of the git
> repository
> in Savannah (commit 1110e30870a8782425067a060d89cc411b014418):
>
>   http://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=
> 1110e30870a8782425067a060d89cc411b014418
>
> Although there's a problem with the solution:
>
>   dualbus@debian:~$ for sh in bash ~/src/gnu/bash-build/bash ksh93 mksh;
> do $sh -c ': | read -n 0; echo $?'; done
>   1
>   0
>   1
>   1
>
> Since the read(2) system call doesn't take place, `read -n 0' doesn't
> detect
> the broken pipe. IMO, it should.
>
> --
> Eduardo Bustamante
> https://dualbus.me/
>