Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/sim/axis/vismach/VMC_toolchange/remap.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /usr/bin/python
#!/usr/bin/env python

from stdglue import *
2 changes: 1 addition & 1 deletion configs/sim/axis/vismach/VMC_toolchange/toplevel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /usr/bin/python
#!/usr/bin/env python

import remap
2 changes: 1 addition & 1 deletion configs/sim/axis/vismach/VMC_toolchange/vmcgui
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright 2009 Alex Joni
#
# This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion docs/src/config/ini-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ This example program filters a file and adds a W axis to match the Z axis.
It depends on there being a space between each axis word to work.

----
#! /usr/bin/env python
#!/usr/bin/env python

import sys

Expand Down
2 changes: 1 addition & 1 deletion docs/src/config/ini_config_fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ Cet exemple de programme filtre un fichier et ajoute un axe W correspondant à
l'axe Z. Il marchera selon la présence d'un espace entre chaque mot d'axe.

----
#! /usr/bin/env python
#!/usr/bin/env python

import sys

Expand Down
4 changes: 2 additions & 2 deletions docs/src/gui/vismach.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ The basic sequence in creating the Vismach model is

== Start the script

It is useful for testing to include the '#!/usr/bin/python' to allow the file
It is useful for testing to include the '#!/usr/bin/env python' to allow the file
to be run as a script. The first thing to do is to import the required
libraries.

----
#!/usr/bin/python
#!/usr/bin/env python

from vismach import *
import hal
Expand Down
2 changes: 1 addition & 1 deletion docs/src/hal/halmodule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ once per second.

[source,c]
----
#!/usr/bin/python
#!/usr/bin/env python
import hal, time
h = hal.component("passthrough")
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/hal/halmodule_fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ entrées. Le composant suivant, un passe-tout, copie la valeur vue sur
ses pins d'entrée (_passe_tout.in_) vers ses pins de sortie
(_passe_tout.out_) approximativement une fois par seconde.
----
#!/usr/bin/python
#!/usr/bin/env python
import hal, time
h = hal.component("passe_tout")
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/mkpre.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""mkpre.py: Convert ASCII art into something that groff can render to
text, HTML, or postscript/pdf

Expand Down
2 changes: 1 addition & 1 deletion lib/python/gladevcp/makepins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# GLADE_VCP
# Copyright 2010 Chris Morley
Expand Down
2 changes: 1 addition & 1 deletion scripts/decode_dmesg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""\
This script decodes hex floats (e.g., in dmesg) into real floats. In the
future maybe it will do other emc2-specific dmesg decoding.
Expand Down
2 changes: 1 addition & 1 deletion scripts/linuxcnc_info
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ show " cpu MHz" $(parse_cpuinfo "cpu MHz")
show " parport" $(cat /proc/ioports|grep parport)
show " serial" $(cat /proc/ioports|grep serial)
echo
echo "Varsions:"
echo "Versions:"
show " gcc" $(gcc --version|head -1)
show " python" $(python --version 2>&1)
show " git" $(git --version)
Expand Down
2 changes: 1 addition & 1 deletion scripts/realtime.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#!/bin/bash
#
# @configure_input@
# on @DATE@
Expand Down
2 changes: 1 addition & 1 deletion scripts/torture.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright (C) 2012 Jeff Epler <jepler@unpythonic.net>
#
# This program is free software; you can redistribute it and/or modify
Expand Down
6 changes: 4 additions & 2 deletions src/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,8 @@ then
AC_MSG_ERROR([awk not found])
fi

if test $RTS != "uspace"
then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this breaks everything on linux uspace 😦
halrun fails like so:

/home/jepler/src/linuxcnc/trasz/scripts/realtime: line 116: syntax error near unexpected token `|'
/home/jepler/src/linuxcnc/trasz/scripts/realtime: line 116: `            if  | awk '{print $1}' | grep -x $MOD >/dev/null ; then'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I know it's a patch I suggested .. without testing it...

AC_PATH_PROG(INSMOD, insmod, "none", $SPATH)
if test $INSMOD = "none"
then
Expand All @@ -824,8 +826,9 @@ if test $LSMOD = "none"
then
AC_MSG_ERROR([lsmod not found])
fi
fi

AC_PATH_PROG(PIDOF, pidof, "none", $SPATH)
AC_PATH_PROGS(PIDOF, pidof pgrep, "none", $SPATH)
if test $PIDOF = "none"
then
AC_MSG_ERROR([pidof not found])
Expand Down Expand Up @@ -1180,7 +1183,6 @@ AC_MSG_RESULT($HAVE_OPTRESET)
AC_SUBST([HAVE_OPTRESET])



LIBS_hold=$LIBS
LIBS=
AC_SEARCH_LIBS(dlopen, [c dl], [
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/axis/scripts/debuglevel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
import sys, os
import gettext
BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), ".."))
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/axis/scripts/image-to-gcode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python

## image-to-gcode is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by the
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/axis/scripts/lintini.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
#!/usr/bin/python
#!/usr/bin/env python
# This is a component of AXIS, a front-end for LinuxCNC
# Copyright 2004, 2005, 2006 Jeff Epler <jepler@unpythonic.net> and
# Chris Radek <chris@timeguy.com>
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/axis/scripts/teach-in.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""Usage:
python teach.py nmlfile outputfile
If outputfile is not specified, writes to standard output.
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/axis/scripts/tracking-test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright 2007 Ben Lipkowitz
# You may distribute this software under the GNU GPL v2 or later
#
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/gmoccapy/gmoccapy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
"""
A try of a new GUI for LinuxCNC based on gladevcp and Python
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/gremlin/gremlin-run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python

import sys
import os
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/gremlin/gremlin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright (C) 2009-2012
# Jeff Epler <jepler@unpythonic.net>,
# Pavel Shramov <psha@kamba.psha.org.ru>,
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/gscreen/gscreen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python

# Gscreen a GUI for linuxcnc cnc controller
# Chris Morley copyright 2012
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/pncconf/pncconf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# This is pncconf, a graphical configuration editor for LinuxCNC
# Chris Morley copyright 2009
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/pncconf/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2.4
#!/usr/bin/env python2.4
# -*- encoding: utf-8 -*-
# This is pncconf, a graphical configuration editor for LinuxCNC
# Chris Morley copyright 2009
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/pyui/master.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
import hal,time,os,sys
import traceback
from configobj import ConfigObj
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/pyui/pyui.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/python
#!/usr/bin/env python
from pyui import master
validate = master.keyboard.validate(master.keyboard())
2 changes: 1 addition & 1 deletion src/hal/user_comps/hal_input.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright 2007 Jeff Epler <jepler@unpythonic.net>
#
# This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/vismach/5axisgui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright 2007 Chris Radek
# Derived from a work by John Kasunich and Jeff Epler
#
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/vismach/hbmgui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
#
# Visulization model of a Horizontal Boring Mill with quill
#
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/vismach/hexagui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright 2007 Ben Lipkowitz
# You may distribute this software under the GNU GPL v2 or later
#
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/vismach/maho600gui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
#
# Visulization model of U of Akron's Maho 600C with 2-axis NC table
#
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/vismach/max5gui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
#
# Visulization model of Chris's MAX-NC mill, as modified to 5-axis
#
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/vismach/puma560gui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright 2009 Alex Joni
#
# This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/vismach/pumagui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright 2007 John Kasunich and Jeff Epler
#
# This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/vismach/scaragui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright 2007 John Kasunich and Jeff Epler
#
# This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion src/hal/utils/elbpcom.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015
# Peter C. Wallace <pcw@mesanet.com> and Jeff Epler <jepler@unpythonic.net>
Expand Down
2 changes: 1 addition & 1 deletion src/hal/utils/halcompile.g
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# This is 'halcompile', a tool to write HAL boilerplate
# Copyright 2006 Jeff Epler <jepler@unpythonic.net>
#
Expand Down
2 changes: 1 addition & 1 deletion src/hal/utils/yapps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python

#
# Yapps 2 - yet another python parser system
Expand Down
2 changes: 1 addition & 1 deletion src/modsilent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python

import re
import sys
Expand Down
7 changes: 7 additions & 0 deletions src/rtapi/rtapi_uspace.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@
*/
#ifndef RTAPI_USPACE_HH
#define RTAPI_USPACE_HH
#ifdef __linux__
#include <sys/fsuid.h>
#endif
#include <unistd.h>
#include <pthread.h>

struct WithRoot
{
#ifdef __linux__
WithRoot() { if(!level) setfsuid(geteuid()); level++; }
~WithRoot() { --level; if(!level) setfsuid(getuid()); }
#else
WithRoot() { if(!level) level++; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, this doesn't seem right. WithRoot::WithRoot() needs to elevate file I/O privs to root, so it can't simply do nothing. But in the long run I'd like to get this fixed up so we can abandon use of linux-specific get/setfsuid altogether.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I suspect I've misunderstood the original intention. I think it should be something like:

+#else

  • WithRoot() { if(!level) seteuid(0); level++; }

It's still missing any kind of error reporting, though.

~WithRoot() { --level; if(!level) seteuid(getuid()); }
#endif
static int level;
};

Expand Down
6 changes: 6 additions & 0 deletions src/rtapi/uspace_rtapi_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

#include "config.h"

#ifdef __linux__
#include <sys/fsuid.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
Expand Down Expand Up @@ -462,7 +464,11 @@ int main(int argc, char **argv) {
"Running with fallback_uid. getuid()=%d geteuid()=%d\n",
getuid(), geteuid());
}
#ifdef __linux__
setfsuid(getuid());
#else
seteuid(getuid());
#endif
vector<string> args;
for(int i=1; i<argc; i++) { args.push_back(string(argv[i])); }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/octave --persist
#!/usr/bin/octave --persist
load movement.log
%Assume 1kHz
t=movement(:,1);
Expand Down
2 changes: 1 addition & 1 deletion tests/trajectory-planner/circular-arcs/process_runlog.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -
#!/bin/bash
#===============================================================================
#
# FILE: process_runlog.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -
#!/bin/bash
set -o nounset # Treat unset variables as an error

if [ -a $1 ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -
#!/bin/bash
set -o nounset # Treat unset variables as an error

if [ -a $1 ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -
#!/bin/bash
set -o nounset # Treat unset variables as an error

if [ -a $1 ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -
#!/bin/bash
set -o nounset # Treat unset variables as an error

if [ -a $1 ]
Expand Down
2 changes: 1 addition & 1 deletion tests/trajectory-planner/circular-arcs/util/save_state.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -
#!/bin/bash
set -o nounset # Treat unset variables as an error

if [ -a $1 ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -
#!/bin/bash
set -o nounset # Treat unset variables as an error

if [ -a $1 ]
Expand Down
2 changes: 1 addition & 1 deletion tests/trajectory-planner/circular-arcs/util/save_vel.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -
#!/bin/bash
set -o nounset # Treat unset variables as an error

if [ -a $1 ]
Expand Down