Project

General

Profile

Actions

Bug #1360

closed

CRYSTAX_PANI: issetugid() not implemented!!! when calling boost::locale::conv::to_utf (10.3.1)

Added by Karol T. almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
libcrystax
Target version:
Start date:
04/06/2016
Due date:
% Done:

100%

Estimated time:
CPU Architecture:
arm
Host OS:
Linux
Toolchain:
gcc-5
Android version:
4.2 (android-17), 5.0 (android-21)
CrystaX NDK Version:

Description

Hello and thank you for this God-sent NDK!

When converting from ISO-8859-* to UTF-8 with Boost.Locale's to_utf function, the program run from the adb shell produces the error message:
CRYSTAX_PANI: issetugid() not implemented!!!

This is on 10.3.1 Linux x86, armeabi-v7a

This is as much as I could narrow the problem. Somehow the backend (iconv?) is calling issetugid. I haven't managed to pinpoint it exactly in the backend.

Thank you for any advice on how to resolve this issue.

Actions #1

Updated by Dmitry M. almost 8 years ago

Yes, issetugid is not implemented in libcrystax. When it's called, it prints error message to stderr and abort application. Honestly speaking, it's unclear how to properly implement this function, since its definition is unclear too. According to the documentation, it's purpose is indication of the fact that process was "tainted", which is very foggy.

Anyway, we're going to fix it in upcoming 11.0 release, where we'd get rid of hybrid libcrystax+bionic scheme, keeping only libcrystax in place. Meanwhile, you can work around this by defining own version of issetugid somewhere in your code:

#ifdef __cplusplus
extern "C"
#endif
int issetugid()
{
    return 0;
}
Actions #2

Updated by Karol T. almost 8 years ago

Thank you for your response, Dmirtry.

I'm glad that you're working on the issue. Unfortunately the workaround you recommended does not seem to work for me. Where should the function be linked to for libcrystax to "see" it?

Thank you for your help.

Actions #3

Updated by Dmitry M. almost 8 years ago

Karol Trojanowski wrote:

I'm glad that you're working on the issue. Unfortunately the workaround you recommended does not seem to work for me. Where should the function be linked to for libcrystax to "see" it?

Hmm, maybe I miss something... Could you provide minimal example where this problem is reproduced? This workaround should work generally, but in some cases there might be conditions (such as load order) preventing it. I could say more if you'd share some example where I could reproduce the problem.

Actions #4

Updated by Karol T. almost 8 years ago

Dmitry Moskalchuk wrote:

Hmm, maybe I miss something... Could you provide minimal example where this problem is reproduced? This workaround should work generally, but in some cases there might be conditions (such as load order) preventing it. I could say more if you'd share some example where I could reproduce the problem.

Here you go:
issetugidtest.cpp

#include <boost/locale.hpp>
#include <string>
#include <iostream>
extern "C" int issetugid() { return 0; }
int main()
{
    using boost::locale::conv::to_utf;
    using namespace std;
    auto data = vector<uint8_t>{ 0xCA, 0xC1, 0xCB, 0xCF, 0xC3, 0xC5, 0xD1, 0xCF, 0xD0, 0xCF, 0xD5, 0xCB, 0xCF, 0xD3, 0x00 };
    auto out_t = u8"ΚΑΛΟΓΕΡΟΠΟΥΛΟΣ";
    string text;
    copy(begin(data), end(data), back_inserter(text));
    auto encoding = string("ISO-8859-7");
    auto ret = to_utf<char>(text, encoding);
    assert(out_t == ret);
    return 0;
}

Android.mk

LOCAL_PATH := $(call my-dir)
NDK_TOOLCHAIN_VERSION := 5
include $(CLEAR_VARS)
LOCAL_MODULE    := issetugidtest
LOCAL_STATIC_LIBRARIES := boost_system_static boost_locale_static
LOCAL_CPPFLAGS += -std=c++14 -fexceptions -Os
LOCAL_SRC_FILES := issetugidtest.cpp
include $(BUILD_EXECUTABLE)
$(call import-module,boost/1.59.0)

Application.mk

APP_ABI := armeabi-v7a
APP_PLATFORM := android-16
APP_STL := gnustl_static

After building:

$ adb push libcrystax.so /data
$ adb push issetugidtest /data
$ adb shell LD_LIBRARY_PATH=/data /data/issetugidtest
CRYSTAX_PANI: issetugid() not implemented!!!
Actions #5

Updated by Dmitry M. almost 8 years ago

Karol Trojanowski wrote:

Here you go:

Thank you for example. As far as I see, defining issetugid helped, as I said – just because in your example it doesn't crash with message indicating that issetugid is not implemented. Commenting out own issetugid implementation bring CRYSTAX_PANI message back, so workaround I initially suggested is definitely working, as expected.

However, there is another crash, which happens somewhere inside iconv_open. This is definitely bug in libcrystax, so I'm going to figure out what's wrong there. Thank you for report.

Actions #6

Updated by Dmitry M. almost 8 years ago

  • Category changed from boost to libcrystax
  • Priority changed from Normal to High
Actions #7

Updated by Dmitry M. almost 8 years ago

  • Status changed from Open to In Progress
Actions #8

Updated by Dmitry M. almost 8 years ago

Here is corresponding test case.

Actions #9

Updated by Dmitry M. almost 8 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

Crash on call of issetugid fixed in master branch. Crash on call of iconv_open is fixed too; however, iconv_open now always return error since it need to have conversion database for work, which is not present on Android. This is separate task though, so I've created new ticket #1398 for it.

Closing this ticket since example code doesn't crash anymore. Instead, it throws C++ exception which outer code can catch and handle. Results of this fix will appear in build #854 at https://dl.crystax.net/builds/.

Actions

Also available in: Atom PDF