Fix is in for the next release. I used your script to produce a shorter testcase.

The error was that

name =. , name   NB. or =:

would do assignment-in-place even if the value in (name) was in use somewhere else, like in another name, or a mapped file, or a boxed value.

Workaround:  replace with

name =. , , name

Henry Rich


On 2/25/2017 8:09 PM, John Baker wrote:
Henry,

The following code reproduces the problem. The (decomm) verb reassigns y during execution and it lingers.


decomm=: 3 : 0
NB.*decomm v--  removes comments  from j words. The (x) argument
NB. specifies whether all blank lines are removed or retained.
NB.
NB. monad:  decomm ctWord
NB.
NB.   decomm jcr 'decomm'  NB. decomment self
NB.
NB. dyad:  pa decomm ctWord
NB.
NB.   1 decomm jcr 'decomm'  NB. remove blanks (default)
NB.   0 decomm jcr 'decomm'  NB. retain all blank lines
1 decomm y
:
NB. mask of unquoted comment starts
c=. ($y)$'NB.' E. ,y
c=. +./\"1 c > ~:/\"1 y e. ''''
y=. ,y
NB. blank out comments
y=. ' ' (I. ,c)} y
y=. y $~ $c
NB. remove blank lines - default
if. x do. y #~ y +./ . ~: ' ' end.
)



NB. character table representation of j words, call:  jcr 'verb'
jcr=:[: ];._1 (10{a.) , [: 5!:5 <


vanishshape=:3 : 0


NB. run dewhitejcr (changes shape of y)

smoutput 'shape of y before';$y

NB. should  not change shape of y
decomm y

smoutput 'shape of y after - has changed';$y
)

NB. run to show shape shifting
vanishshape jcr 'decomm'



On Sat, Feb 25, 2017 at 5:47 PM, John Baker <[email protected] <mailto:[email protected]>> wrote:

    Boy talk about responsive support. I don't think any of us are
    expecting mostly volunteer J developers to leave parties to
    address bugs.

    Cheers

    On Sat, Feb 25, 2017 at 5:09 PM, Henry Rich <[email protected]
    <mailto:[email protected]>> wrote:

        I got away from the party & can confirm that the error is in
        inplaced y=. ,y .  I still need your testcase so I can verify
        the fix.

        hhr


        On 2/25/2017 6:38 PM, John Baker wrote:

            Hi Henry,

            I will put together a simple script that reproduces the
            problem. I will
            send a zip directly to your email to avoid all the line
            wrapping issues
            people suffer when sending j code through forum mail.

            Cheers

            On Sat, Feb 25, 2017 at 4:26 PM, Henry Rich
            <[email protected] <mailto:[email protected]>> wrote:

                Please send me a simple case to reproduce this.

                Henry Rich


                On 2/25/2017 6:15 PM, John Baker wrote:

                    Greetings,

                    While preparing a minor JOD update to better
                    support editing when running
                    JOD from
                    jconsole I noticed the compj verb in JOD was no
                    longer completely
                    compressing words.

                    This caused my JOD build scripts to fail so I
                    started debugging and
                    noticed
                    J 8.05 can lose the shape of explicit J y
                    arguments under some
                    circumstances. This is
                    a very serious bug! Observe the following
                    debugging trace of the
                    (compressj) word listed
                    at the end of this message.

                    NB. debugging trace - of running JOD session with
                    all objects created

                          JVERSION

                    Engine: j805/j64/windows

                    Release: commercial/2016-12-11T08:02:16

                    Library: 8.05.11

                    Qt IDE: 1.5.3/5.6.2

                    Platform: Win 64

                    Installer: J805 install

                    InstallPath: c:/j64/j64-805

                    Contact: www.jsoftware.com <http://www.jsoftware.com>


                         dbr 1

                    1 pick compj_3_ 'docfmt2'

                    |stop: compressj

                    | w=.1 e.CWSONLY E.,y

                    |compressj[13]

                    $y

                    28 71

                    |stop

                    | iy=.y

                    |compressj[16]

                    |stop

                    | u=.dewhitejcr y

                    |compressj[17]

                    |stop

                    | w

                    |compressj[18]

                    $ y

                    1988

                    $ iy

                    1988

                    At no point is y reassigned in the local scope yet
                    its shape has changed.
                    Even the shape
                    of the copy iy was also changed.  The verb
                    dewhitejcr seems to strip  the
                    shape from y
                    in the local scope.  This verb has been working
                    fine for years so this is
                    clearly some
                    change in J system code.

                    Local values losing their shape due to system side
                    effects is one of those
                    all out the water bugs.  All the code compressj
                    references is attached
                    below.

                    Please contact me if you need help reproducing the
                    error.

                    NB. compressj code follows

                    compressj=:3 : 0


                    NB.*compressj v-- removes all white space from J
                    words and

                    NB. shortens local names. This process reduces the
                    readability of

                    NB. code and should only be applied to production
                    code.

                    NB.

                    NB. monad: cl =. compressj ct

                    NB.

                    NB. compressj jcr 'verbname'

                    NB.

                    NB. NB. call in object context

                    NB. compressj__UT__JODobj jcr_ajod_ 'compressj_base_'


                    NB. check for presence of white space only removal tag

                    w=. 1 e. CWSONLY E. ,y


                    NB. always remove white space

                    u=. dewhitejcr y

                    if. w do. u return. end.


                    NB. do not compress identifiers in code that cannot be

                    NB. reliably classified by the namecats verb.

                    if. badrc m=. 1 namecats__MK y do. u return. end.

                    d=. ~. ;(<2 3 4;1){m=. rv m


                    NB. check for presence of obfuscation tag

                    if. o=. 1 e. OBFUSCATE E. ,y do.

                    NB. local names less J arguments

                    l=. ;(<1;1){m

                    l=. l -. JARGS__MK

                    else.

                    NB. local names less any single char names

                    l=. ;(<1;1){m

                    s=. l #~ 1 = #&> l

                    l=. l -. s

                    end.


                    NB. remove object references

                    l=. l -. exobrefs l,;(<0;1){m


                    NB. local names less any declared and for. names

                    if. 0=#m=. l -. d do. u return. end.


                    NB. remove any names with embedded locale references

                    if. 0=#m=. m #~ -. islocref&> m do. u return. end.


                    if. o do.

                    NB. form obsfucated name replacements - drop
                    trailing _ in (NAMEALPHA)

                    bnr=. (<:#NAMEALPHA)&#.@((}:NAMEALPHA)&i.)^:_1

                    r=. ' ' -.~ ,'/' ,"1 (>m) ,"1 '/' ,"1 OBFUSCPFX
                    ,"1 bnr (#m)?OBFUSCCNT

                    else.

                    NB. form replacements from any remaining chars
                    !(*)=. SHORTNAMES

                    NB. J arguments m n x y u v are not on SHORTNAMES

                    if. 0=#r=. SHORTNAMES -. ,&.> s do. u return. end.

                    if. (#r) < #m do.

                    NB. we have more replacements than available
                    SHORTNAMES

                    NB. form base (#r) numbers using SHORTNAMES digits

                    bnr=. (#r)&#.@((;r)&i.)^:_1

                    r=. r,<"1(#r) }. bnr i. #m

                    end.

                    r=. ; '/' ,&.> m ,. (#m) {. r

                    end.


                    NB. replace tokens

                    r changetok u

                    )



                    decomm=:3 : 0

                    NB.*decomm v-- removes comments from j words. The
                    (x) argument

                    NB. specifies whether all blank lines are removed
                    or retained.

                    NB.

                    NB. monad: decomm ctWord

                    NB.

                    NB. decomm jcr 'decomm' NB. decomment self

                    NB.

                    NB. dyad: pa decomm ctWord

                    NB.

                    NB. 1 decomm jcr 'decomm' NB. remove blanks (default)

                    NB. 0 decomm jcr 'decomm' NB. retain all blank lines

                    1 decomm y

                    :

                    NB. mask of unquoted comment starts

                    c=. ($y)$'NB.' E. ,y

                    c=. +./\"1 c > ~:/\"1 y e. ''''

                    y=. ,y

                    NB. blank out comments

                    y=. ' ' (I. ,c)} y

                    y=. y $~ $c

                    NB. remove blank lines - default

                    if. x do. y #~ y +./ . ~: ' ' end.

                    )



                    dewhitejcr=:3 : 0


                    NB.*dewhitejcr v-- removes all redundant blanks
                    from J code.

                    NB. Result is a character list in linear
                    representation format.

                    NB.

                    NB. monad: cl =. dewhitejcr ct

                    NB.

                    NB. dewhitejcr jcr 'anyword'


                    tt=. ;:&.> <"1 (ljust@:decomm) y NB. list of
                    tokenized lines

                    ; (blkaft&.> tt) ,&.> LF NB. insert blanks, LF's
                    and raise

                    )


                    NB. extract object references from blcl of names

                    exobrefs=:a:"_ -.~ [: ~. [: ; [: <;._1&.> ([:
                    +./\&.> (<'__')"_ E.&.> ])
                    #&.> ]


                    NB. 1 if name is a locale reference 0 otherwise

                    islocref=:('_'"_ = {:) +. [: +./ '__'"_ E. ]


                    NB. left justify table

                    ljust=:' '&$: :(] |."_1~ i."1&0@(] e. [))


                    NB. ok return value

                    rv=:>@(1&{)
                    
----------------------------------------------------------------------
                    For information about J forums see
                    http://www.jsoftware.com/forums.htm
                    <http://www.jsoftware.com/forums.htm>

                
----------------------------------------------------------------------
                For information about J forums see
                http://www.jsoftware.com/forums.htm
                <http://www.jsoftware.com/forums.htm>





        ----------------------------------------------------------------------
        For information about J forums see
        http://www.jsoftware.com/forums.htm
        <http://www.jsoftware.com/forums.htm>




-- John D. Baker
    [email protected] <mailto:[email protected]>




--
John D. Baker
[email protected] <mailto:[email protected]>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to