Coder Social home page Coder Social logo

e's Issues

Compilation failure error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]

GCC version.

$ cc --version
cc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Errors.

$ make
mkdir -p /home/foobar/.estx
cp stx/* /home/foobar/.estx
mkdir -p bin/
cc main.c src/clipboard.c src/editor.c src/buffer.c src/util.c src/colors.c src/syntax.c -DSTXDIR=\"/home/foobar/.estx\" -o bin/e -Werror -Wall -g -fPIC -O2 -DNDEBUG -ftrapv -Wfloat-equal -Wundef -Wwrite-strings -Wuninitialized -pedantic -std=c11
src/editor.c: In function ‘e_die’:
src/editor.c:24:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
   write(STDOUT_FILENO, "\x1b[2J\x1b[?47l\x1b""8", 12);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/editor.c: In function ‘e_exit’:
src/editor.c:31:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
   write(STDOUT_FILENO, "\x1b[2J\x1b[?47l\x1b""8", 12);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/editor.c: In function ‘e_clear_screen’:
src/editor.c:214:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
   write(STDOUT_FILENO, ab.b, ab.len);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/editor.c: In function ‘e_setup’:
src/editor.c:1214:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
   write(STDOUT_FILENO, "\x1b""7\x1b[?47h", 8);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
src/syntax.c: In function ‘syntax_read_extensions’:
src/syntax.c:26:5: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
     fgets(line, MAX_LINE_WIDTH, f);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/syntax.c: In function ‘syntax_read_pattern’:
src/syntax.c:55:5: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
     fgets(line, MAX_LINE_WIDTH, f);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:11: recipe for target 'all' failed
make: *** [all] Error 1

Segmentation Fault

I just downloaded e for both Raspberry Pi (arm) and MAC OSX. e compiled cleanly on both machines however I get a segmentation fault on Raspberry Pi. Runs cleanly on Mac. Just an FYI.

Syntax highlighting is buggy in some cases

The cases I've seen:

  • Closing a multiline pattern doesn't always update the highlighting
  • Highlighting search results doesn't end where it's supposed to (highlights entire line)

e license would be useful

Hi,

Have you put any consideration into the license you plan to use for e? I'm working on a FreeBSD port at the minute and it would be great to be able to put that into the initial port submission.

Pressing <esc> in binary files leads to segfault

For reasons I’m not entirely certain of at the moment, pressing when working with a binary file leads to a segmentation fault. It seems to be related with drawing, but pressing shouldn’t do anything in edit mode, so I’m a bit confused.

Cheers

Installation issue

Hey, when I try to make install on Fedora 25 I get this. Any ideas?

❯ make install                                                                  
mkdir -p /home/oskar/.estx
cp stx/* /home/oskar/.estx
mkdir -p bin/
cc main.c src/editor.c src/buffer.c src/util.c src/colors.c src/syntax.c -DSTXDIR=\"/home/oskar/.estx\" -o bin/e -Werror -Wall -g -fPIC -O2 -DNDEBUG -ftrapv -Wfloat-equal -Wundef -Wwrite-strings -Wuninitialized -pedantic
In file included from main.c:3:0:
src/editor.h:1:0: error: "_DEFAULT_SOURCE" redefined [-Werror]
 #define _DEFAULT_SOURCE
 
In file included from /usr/include/signal.h:28:0,
                 from main.c:1:
/usr/include/features.h:185:0: note: this is the location of the previous definition
 # define _DEFAULT_SOURCE 1
 
cc1: all warnings being treated as errors
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 1

Make WASD customizable

WASD is not ergonomic on some keyboard layouts, and it would be a good idea to create a simple way to change them. Currently, we do these movements in a switch statement, meaning we cannot have non-constants. It would make sense to make this scriptable through Lua, though.

Thanks to this comment on HN for making me aware of this issue.

Skin-tone modifiers et al confuse the cursor

Related to #28: when using new-fangled Unicode fetures like skin-tone modifiers or emoji ligatures, the cursor becomes very unhappy as well. It is sort of the reverse problem that we have with full-width characters. We should probably handle all of those problems in one fell (and hopefully graceful) swoop.

Full-Width characters confuse the cursor

Fullwidth characters, such as kana (e.g. なんでやねん) or even fullwidth roman characters (e.g. oh no) confuse the cursor: it gets place at a normal halfwidth position, which is obviously wrong. Example:

bildschirmfoto 2017-09-07 um 15 19 15

This does not affect the capabilities of editing such a text, but the application still becomes more or less useless, because the cursor position is not correct.

0 on all lines

On WSL Ubuntu 16.04, all lines start 0, and the cursor is one/two to the left of where it should be.

heap buffer overflow int syntax_read_file

cp ./poc.stx ./stx
run ./bin/e

touch a file contains "\x00\x00\x00\x00" like poc.stx. run

fgets not return NULL but strlen return 0. so "ln =-1", line[ln] will error.

while (fgets(line, MAX_LINE_WIDTH, f)) {
    lineno++;
    ln = strlen(line)-1;
    line[ln] = '\0';                 //error
}
==2851==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d00001ea7f at pc 0x00000040d428 bp 0x7ffd417b66f0 sp 0x7ffd417b66e0
WRITE of size 1 at 0x61d00001ea7f thread T0
    #0 0x40d427 in syntax_read_file src/syntax.c:126
    #1 0x40d5d0 in syntax_init src/syntax.c:174
    #2 0x401d69 in main /home/fuzz/github/e_bak/main.c:49
    #3 0x7f32df71e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #4 0x401fc8 in _start (/home/fuzz/github/e_bak/bin/e+0x401fc8)

0x61d00001ea7f is located 1 bytes to the left of 2048-byte region [0x61d00001ea80,0x61d00001f280)
allocated by thread T0 here:
    #0 0x7f32dfb60602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x40d17e in syntax_read_file src/syntax.c:109

SUMMARY: AddressSanitizer: heap-buffer-overflow src/syntax.c:126 syntax_read_file
Shadow bytes around the buggy address:
  0x0c3a7fffbcf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fffbd00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fffbd10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fffbd20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fffbd30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c3a7fffbd40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
  0x0c3a7fffbd50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3a7fffbd60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3a7fffbd70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3a7fffbd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3a7fffbd90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==2851==ABORTING

testcase:https://github.com/xcainiao/poc/blob/master/e_heap-buffer-overflow_syntax_read_file.stx

Make tab width non-global

Currently there is a global variable E_TAB_WIDTH that tells us how wide the tab should be. This shouldn't be too hard to convert into a local variable in the editor state.

Double 'h' key crashes e

In INIT mode, if you type 'h' to "hide" on an empty line, follow it then with an additional 'h' with cause e to crash on Ubuntu 16.04 and Fedora 26 respectfully.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.