bugFreeciv - Bugs: bug #22282, convert_string() / iconv() error...

 
 
Show feedback again

bug #22282: convert_string() / iconv() error reporting could be more specific

Submitted by:  Jacob Nevins <jtn>
Submitted on:  Sun 06 Jul 2014 11:39:24 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalStatus: None
Assigned to: NoneOpen/Closed: Open
Release: Operating System: Any
Planned Release: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 25 Aug 2014 12:39:50 PM UTC, comment #1:

I wondered about just adding fc_strerror(fc_get_errno()) to the string.

However, on Windows, that turns into FormatMessage(GetLastError()), effectively. This isn't appropriate for errors returned by iconv, which I think sets the real errno (which is separate from GetLastError()) and thus should have the real system strerror() called on it. (I think Windows has an EILSEQ/EINVAL etc so should be able to provide useful strings for it.)

Nearby we have

which I think will currently do the Wrong Thing on Windows (should it ever occur), so should be fixed at the same time.

However, I can't test Windows builds, so I'm not confident making these changes.

(I guess we probably get away with calling fc_strerror() after fopen() etc because that probably also sets the error code retrieved from GetLastError() as well as the POSIX-y errno? But I don't think the third-party iconv library will do so, or at least I've found no evidence in the source code.)

Jacob Nevins <jtn>
Project Administrator
Sun 06 Jul 2014 11:39:24 AM UTC, original submission:

Currently convert_string() just says "Invalid string conversion from %s to %s." if it encounters an error related to the body of the string.

There are some defined errno meanings for iconv(), so the message could sometimes be more specific.

Jacob Nevins <jtn>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jtn (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup