Comments (10)
Does this commit fix it? 1dff7fe
-- steve
from space-nerds-in-space.
Unfortunately not.
I don't know if it helps but locale
returns:
LANG=el_GR.UTF-8
LANGUAGE=
LC_CTYPE="el_GR.UTF-8"
LC_NUMERIC="el_GR.UTF-8"
LC_TIME="el_GR.UTF-8"
LC_COLLATE="el_GR.UTF-8"
LC_MONETARY="el_GR.UTF-8"
LC_MESSAGES="el_GR.UTF-8"
LC_PAPER="el_GR.UTF-8"
LC_NAME="el_GR.UTF-8"
LC_ADDRESS="el_GR.UTF-8"
LC_TELEPHONE="el_GR.UTF-8"
LC_MEASUREMENT="el_GR.UTF-8"
LC_IDENTIFICATION="el_GR.UTF-8"
LC_ALL=
and after export LANG=en_US.UTF-8
, it returns:
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
from space-nerds-in-space.
Huh. Been searching around for "best practices" with locale, but not finding anything obviously definitive.
Ok, can you try changing snis_server.c and snis_client.c, search for setlocale:
scameron@sleekness ~/github/space-nerds-in-space $ grep setlocale *.c
snis_client.c: if (!setlocale(LC_ALL, "C"))
snis_server.c: if (!setlocale(LC_ALL, "C"))
Change those lines and instead of "C" put "" and see if that works. If that doesn't work,, then try changing it to "en_US.UTF-8"
It seems extremely weird and broken that I would have to change it to "en_US.UTF-8" just to prevent sscanf from segfaulting if I feed it a float, but maybe people in charge of glibc/posix/whatever committee decides what locale does really are that crazy.
Let me know what you find out trying those (and thanks for reporting this.)
from space-nerds-in-space.
grep gave me 3 files:
snis_client.c: if (!setlocale(LC_ALL, "C"))
snis_limited_client.c: if (!setlocale(LC_ALL, "C"))
snis_server.c: if (!setlocale(LC_ALL, "C"))
I tried C
,""
, en_US.UTF-8
, and el_GR.UTF-8
but nothing changed. And i did compiled them with make :)
from space-nerds-in-space.
Ok thanks. Interesting. Now I am confused.
-- steve
from space-nerds-in-space.
Sorry didn't mean to :)
I'll try some more test tomorrow because its too late here, and I'll send you back.
It may be something ubuntu specific..
from space-nerds-in-space.
GNU Debugger says:
Program received signal SIGSEGV, Segmentation fault.
0x080744be in mesh_distort (m=0x0, distortion=0.100000001) at mesh.c:30
30 for (i = 0; i < m->nvertices; i++) {
and
(gdb) print i
$1 = 0
(gdb) print m
$2 = (struct mesh *) 0x0
(gdb) print m->nvertices
Cannot access memory at address 0x4
from space-nerds-in-space.
Yeah, it's not sscanf() that's seg faulting, that was a hasty assumption on my part. fscanf is failing to read some floats, rc below is probably -1 or in any case, not 3, so you get that message "failed reading normal at line..."
static int read_facet(FILE *f, struct triangle *t, int *linecount)
{
int i, rc;
rc = fscanf(f, " facet normal %f %f %f\n", &t->n.x, &t->n.y, &t->n.z);
t->n.w = 1.0;
t->n.ww = 1.0;
(*linecount)++;
if (rc != 3) {
fprintf(stderr, "failed reading normal at line %d\n", *linecount);
return -1;
}
which having failed to read the floats, which is part of reading in an STL mesh, later on the program assumes the meshes are read correctly, and tries to use them, but they were never read, and so all the meshes are NULL.
Still don't understand why using setlocale() at the beginning of main() to explicitly set the locale doesn't help, yet "export LANG=..." does help. I would have thought the point of setlocale was to ... set the locale. But maybe it's too late by the time main() runs and glibc has already remembered what the locale is before main starts?
I suppose we can try setenv("LANG", "en_US.UTF-8", 1); instead of the setlocale, but it would surprise me if that worked but setlocale didn't. Maybe a separate main to set the locale, then exec() the real program? That seems crazy though, and that point, the answer is probably just a shell script to do the launching.
I am assuming you're using all the stl files from github, and haven't substituted your own stl files, correct? The STL parser I wrote was hastily written to read the stl files that openscad outputs, if you drop arbitrary stl files from some other program in there... quite possible it might break (although then export LANG=blah probably wouldn't fix it.) UNLESS... maybe the stl files which openscad generates come out differently if LANG is not "en_US.UTF-8"?
What does share/snis/models/asteroid.stl look like? For me, it looks like this:
scameron@sleekness ~/github/space-nerds-in-space/share/snis/models $ head asteroid.stl
solid OpenSCAD_Model
facet normal -0.995494 -0.0939133 -0.0130838
outer loop
vertex -18.7451 -6.88405 1.10944
vertex -19.4245 -0.191237 4.75956
vertex -19.0563 -2.67103 -5.45181
endloop
endfacet
facet normal -0.995494 -0.0939133 -0.0130838
outer loop
-- steve
from space-nerds-in-space.
setenv worked 👍
BTW, the file asteroid.stl is the same as yours.
from space-nerds-in-space.
fixed in 19d5a63
from space-nerds-in-space.
Related Issues (20)
- snis_client --monitor option has been broken since the SDL2 conversion
- Bug in show_demon_3d() HOT 1
- {request} web interface single computer host HOT 8
- sudo make install - failing with specified parameters HOT 14
- inconsistencies in help function on comms screen HOT 5
- keyboard mappings and interface design for communications station HOT 9
- scan contact velocity is a single number, should be three HOT 6
- keymap & UI/UX: Science! HOT 3
- UX & keymapping wishlist for engineering HOT 5
- missile launch failure HOT 4
- wishlist item for weapon screen: autofire phaser mode HOT 2
- weapons screen wishlist item: zoom HOT 1
- weapons screen wishlist: target specific systems HOT 2
- weapons screen controls request: phaser wavelength hotkeys HOT 1
- helm controls requests HOT 7
- Allow return to lobby from ESC menu HOT 1
- Allow and display keyboard shortcuts in the quit dialogue
- implement conservation of momentum HOT 9
- Fix libglew1.5-dev installation failure; update related documentation HOT 1
- Compile issue - mathutils.c HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from space-nerds-in-space.