zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] db/gdbm rewrite
Date: Thu, 16 Feb 2017 10:16:58 +0000	[thread overview]
Message-ID: <20170216101658.46555c47@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <1487154163.615323.881647656.040AB25F@webmail.messagingengine.com>

On Wed, 15 Feb 2017 02:22:43 -0800
Sebastian Gniazdowski <psprint2@fastmail.com> wrote:
> Changes:
> – data is (un)metafied – compatibility with normal database usage
> – new parameter "zgdbm_tied", array holding tied parameters' names
> – new builtin "zgdmpath", returning ($REPLY) path to database file, of
> given tied parameter
> – new tests (Unicode, metafication, new parameter)
> – updated documentation
> 
> Original db_gdbm was a no-go because it sucked widget names into
> database:
> 
> https://asciinema.org/a/12ffm5ltpj9udnmradtat17am
> 
> Current db_gdbm is a no-go because GDBM doesn't always return \0
> terminated strings.. Sorry for that, but the update solves this.
> 
> I sent is as patch, plus the new file (as option, patch includes)
> Test/V11db_gdbm.ztst.

Thanks.

I've fixed the following warnings (which are trivial).

I'm also getting a test failure from allocation.  My gdbm is quite old,
1.8.3, but it also looks like I have --enable-zsh-mem, which you don't,
as well as --enable-zsh-debug, so the difference is more likely to be
that.  Just running the test code on its own is enough to show it up.

The error from the debug  is on the line

dbase[testkey]=testdata

I've added the stack trace; the key context will be frame 2: it's the
first zsfree() in gdbmsetfn().  Is it simply counting of terminating
'\0's again, or should it not actually be treating the data as a
string at all?

pws

db_gdbm.c: In function ‘bin_zgdbmpath’:
db_gdbm.c:231:15: warning: unused variable ‘reply_pm’ [-Wunused-variable]
     Param pm, reply_pm;
               ^~~~~~~~
db_gdbm.c: In function ‘scangdbmkeys’:
db_gdbm.c:437:16: warning: unused variable ‘content’ [-Wunused-variable]
     datum key, content;
                ^~~~~~~
db_gdbm.c:436:11: warning: unused variable ‘pm’ [-Wunused-variable]
     Param pm = NULL;
           ^~

% make TESTNUM=V11 ZTST_verbose=1
if test -n "gcc"; then \
  cd .. && DESTDIR= \
  make MODDIR=`pwd`/Test/Modules install.modules > /dev/null; \
fi
if ZTST_testlist="`for f in ./V11*.ztst; \
           do echo $f; done`" \
 ZTST_srcdir="." \
 ZTST_exe=../Src/zsh \
 ../Src/zsh +Z -f ./runtests.zsh; then \
 stat=0; \
else \
 stat=1; \
fi; \
sleep 1; \
rm -rf Modules .zcompdump; \
exit $stat
./V11db_gdbm.ztst: starting.
Running test: unload and reload the module without crashing
Test successful.
Running test: create the database
Test successful.
Running test: open the database read-only
Test successful.
Running test: store key in database
--- /tmp/zsh.ztst.19816/ztst.err	2017-02-16 09:58:41.220556989 +0000
+++ /tmp/zsh.ztst.19816/ztst.terr	2017-02-16 09:58:41.258558381 +0000
@@ -0,0 +1 @@
+6: mem.c:1512: BUG: attempt to free more than allocated.
Test ./V11db_gdbm.ztst failed: error output differs from expected as shown above for:
 ztie -d db/gdbm -f $dbfile dbase
 dbase[testkey]=testdata
 zuntie dbase
 ztie -r -d db/gdbm -f $dbfile dbase
 echo $dbase[testkey]
 zuntie -u dbase
Was testing: store key in database
./V11db_gdbm.ztst: test failed.
**************************************
0 successful test scripts, 1 failure, 0 skipped
**************************************
make: *** [check] Error 1

#0  zfree (p=0x8733c30, sz=0) at mem.c:1512
#1  0x080a4ce4 in zsfree (p=0x8733c30 "testdata\030<s\b\377\377\377\377H<s\b\377\377\377\377P<s\b\377\377\377\377h<s\b\377\377\377\377dbase") at mem.c:1662
#2  0x00668a15 in gdbmsetfn (pm=0x8737a90, val=0x8731998 "testdata") at db_gdbm.c:348
#3  0x080b1c1c in assignstrvalue (v=0xbfbd4cdc, val=0x8731998 "testdata", flags=0) at params.c:2456
#4  0x080b3629 in assignsparam (s=0xb775abad "[testkey]", val=0x8731998 "testdata", flags=0) at params.c:3035
#5  0x08070c6c in addvars (state=0xbfbd50a0, pc=0xb775ab30, addflags=0) at exec.c:2462
#6  0x0806d5a4 in execsimple (state=0xbfbd50a0) at exec.c:1173
#7  0x0806daa6 in execlist (state=0xbfbd50a0, dont_change_job=0, exiting=0) at exec.c:1312
#8  0x0806d473 in execode (p=0xb775ab00, dont_change_job=0, exiting=0, context=0x80edc37 "toplevel") at exec.c:1130
#9  0x0808ccdd in loop (toplevel=1, justonce=0) at init.c:208
#10 0x080901d8 in zsh_main (argc=1, argv=0xbfbd5344) at init.c:1692
#11 0x0805433c in main (argc=1, argv=0xbfbd5344) at ./main.c:93


  reply	other threads:[~2017-02-16 10:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 12:20 Sebastian Gniazdowski
2017-02-15 10:22 ` Sebastian Gniazdowski
2017-02-16 10:16   ` Peter Stephenson [this message]
2017-02-16 11:46     ` Sebastian Gniazdowski
2017-02-16 12:52       ` Peter Stephenson
2017-02-16 14:25         ` Sebastian Gniazdowski
2017-02-16 14:30           ` Sebastian Gniazdowski
2017-02-16 15:11             ` Peter Stephenson
2017-02-16 16:03               ` Sebastian Gniazdowski
2017-02-16 16:25                 ` Sebastian Gniazdowski
2017-02-16 16:36                   ` Peter Stephenson
2017-02-16 17:12                     ` Sebastian Gniazdowski
2017-02-16 18:16                 ` Sebastian Gniazdowski
2017-02-19  0:43 (Fwd) " Bart Schaefer
2017-02-19  8:46 ` Sebastian Gniazdowski
2017-02-19 18:19   ` Bart Schaefer
2017-02-20  8:32     ` Sebastian Gniazdowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170216101658.46555c47@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).