patchWeeChat - Patches: patch #6980, script_action_install /...

 
 

patch #6980: script_action_install / script_search_by_full_name basename bug under *BSD/OSX

Submitter:  bazerka <bazerka>
Submitted:  Mon 16 Nov 2009 12:25:20 AM UTC
   
 
Category:  script plugin Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  flashcode Open/Closed:  Closed
IRC nick:  Bazerka
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 16 Nov 2009 09:56:12 AM UTC, comment #1: 

As discussed in IRC with FlashCode, patch has been modified to remove the basename strdup in script_search_by_full_name as it is unneeded. Also remove the full_name_copy strdup which is also unneeded and check against full_name directly.

Patch is against git master and tested successfully on FreeBSD 7.2 and Debian 5.

(file #19065)

bazerka <bazerka>
Mon 16 Nov 2009 12:25:20 AM UTC, original submission:  

The behaviour of basename(3) in *BSD/OSX differs to that of Linux/Solaris, in that its internal storage buffer is kept across multiple calls to basename(3). As a result, you must copy the string out of the buffer each time prior to further basename(3) calls.

Due to this behaviour and how WeeChat currently uses basename, under *BSD/OSX, script_search_by_full_name will immediately match the first script in the loaded scripts list. The end effect of this is that /weeget install <script> will cause the first script to be unloaded from memory and its file overwritten on disk.

For example:

00:22:24 | WeeChat 0.3.0 [compiled on Nov 16 2009 00:21:53]
00:22:24 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00:22:24 | python scripts loaded: autojoin_on_invite, bufsave, uname, weeget
00:22:24 | Plugins loaded: alias, aspell, fifo, irc, logger, perl, python, xfer
00:22:38 | weeget: downloading list of scripts...
00:22:38 | weeget: scripts downloaded
00:22:39 | weeget: downloading "shell.py"...
00:22:39 | python: unloading script "autojoin_on_invite"
00:22:39 | python: script removed: /home/bazerka/.weechat/python/autoload/autojoin_on_invite.py
00:22:39 | python: script removed: /home/bazerka/.weechat/python/autojoin_on_invite.py
00:22:39 | python: loading script "/home/bazerka/.weechat/python/autojoin_on_invite.py"
00:22:39 | python: registered script "shell", version 0.4 (Run shell commands in WeeChat)



bazerka <bazerka>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #19065:  script.c.rev2.diff added by bazerka (2KiB - text/x-patch - Revised patch)
file #19061:  script.c.diff added by bazerka (2KiB - text/x-patch - Patch and test code/results to demonstrate behaviour)
file #19062:  weechat-basename.txt added by bazerka (4KiB - text/plain - Patch and test code/results to demonstrate behaviour)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by flashcode (Updated the item)
  • -email is unavailable- added by bazerka (Submitted the item)
  • -email is unavailable- added by bazerka
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-01-23 flashcode Open/ClosedOpen Closed
    2009-11-16 flashcode StatusNone Done
        Assigned toNone flashcode
    2009-11-16 bazerka Attached File- Added script.c.rev2.diff, #19065
    2009-11-16 bazerka Attached File- Added script.c.diff, #19061
        Attached File- Added weechat-basename.txt, #19062
        Carbon-Copy- Added bazerka

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code