New submission from Jeffrey Armstrong:

The function fcicreate in PC/_msi.c can return nonsense if the list of files 
passed to msilib.FCICreate does not contains tuples as expected.  To replicate,

import msilib
msilib.FCICreate("test.cab", ["entry.txt"])

The above code will return a ValueError of the format:

ValueError: FCI error 11260524

The error code is meaningless.  If one were to examine the code, you can see in 
PC/_msi.c:246 (in "current"):


        if (!PyArg_ParseTuple(item, "ss", &filename, &cabname))
            goto err;

If we look at the error handler at PC/_msi.c:262, it assumes that one of the 
Windows MSI API calls had failed, and will print the contents of the ERF error 
structure:

err:
    PyErr_Format(PyExc_ValueError, "FCI error %d", erf.erfOper); /* XXX better 
error type */

In the case where the list does not contain tuples, the value of erf.erfOper 
was never initialized or set because the error being raised is not due to the 
Windows MSI API.  The error is highly misleading as it is simply an argument 
error.

----------
components: Extension Modules
messages: 222458
nosy: Jeffrey.Armstrong
priority: normal
severity: normal
status: open
title: Nonsense errors reported by msilib.FCICreate for bad argument
type: behavior
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21931>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to